快捷方式

torch.Tensor.index_put_

Tensor.index_put_(indices, values, accumulate=False) Tensor

使用 indices (张量元组) 中指定的索引,将张量 values 中的值放入张量 self 中。表达式 tensor.index_put_(indices, values) 等效于 tensor[indices] = values。返回 self

如果 accumulateTrue,则 values 中的元素将添加到 self 中。如果 accumulate 为 False,则当索引包含重复元素时,行为未定义。

参数
  • indices (LongTensor 元组) – 用于索引到 self 中的张量。

  • values (Tensor) – 与 self 具有相同 dtype 的张量。

  • accumulate (bool) – 是否累加到 self 中

文档

访问 PyTorch 的综合开发者文档

查看文档

教程

获取面向初学者和高级开发者的深度教程

查看教程

资源

查找开发资源并获得您的问题解答

查看资源