torch.Tensor.index_put_¶ Tensor.index_put_(indices, values, accumulate=False) → Tensor¶ 使用 indices (张量元组) 中指定的索引,将张量 values 中的值放入张量 self 中。表达式 tensor.index_put_(indices, values) 等效于 tensor[indices] = values。返回 self。 如果 accumulate 为 True,则 values 中的元素将添加到 self 中。如果 accumulate 为 False,则当索引包含重复元素时,行为未定义。 参数 indices (LongTensor 元组) – 用于索引到 self 中的张量。 values (Tensor) – 与 self 具有相同 dtype 的张量。 accumulate (bool) – 是否累加到 self 中