快捷方式

torch.Tensor.index_put_

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

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

如果 accumulateTrue,则将 values 中的元素添加到 self 中。如果 accumulateFalse,并且 indices 包含重复元素,则行为是未定义的。

参数
  • indices (tuple of LongTensor) – 用于对 self 进行索引的张量。

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

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

文档

访问 PyTorch 的全面开发者文档

查看文档

教程

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

查看教程

资源

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

查看资源