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