torch.Tensor.index_put_¶ Tensor.index_put_(indices, values, accumulate=False) → Tensor¶ 使用 values 張量中的值,並使用 indices (一個張量元組) 中指定的索引將其放入 self 張量中。 運算式 tensor.index_put_(indices, values) 等同於 tensor[indices] = values。 傳回 self。 如果 accumulate 為 True,則 values 中的元素會加到 self。 如果 accumulate 為 False,且索引包含重複元素,則行為未定義。 參數 indices (LongTensor 的 tuple) – 用於索引到 self 的張量。 values (Tensor) – 與 self 相同 dtype 的張量。 accumulate (bool) – 是否累加到 self 中