快捷方式

torch.Tensor.index_put_

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

使用 values 張量中的值,並使用 indices (一個張量元組) 中指定的索引將其放入 self 張量中。 運算式 tensor.index_put_(indices, values) 等同於 tensor[indices] = values。 傳回 self

如果 accumulateTrue,則 values 中的元素會加到 self。 如果 accumulate 為 False,且索引包含重複元素,則行為未定義。

參數
  • indices (LongTensortuple) – 用於索引到 self 的張量。

  • values (Tensor) – 與 self 相同 dtype 的張量。

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

文件

存取 PyTorch 的完整開發者文件

檢視文件

教學課程

取得適合初學者和進階開發人員的深入教學課程

檢視教學課程

資源

尋找開發資源並取得問題的解答

檢視資源