快捷方式

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 的全面開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深入教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源