评价此页

Tensor.index_put_() ##

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

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

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

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

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

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