该接口计划废弃,可以使用torch.fill_或torch.ones_like接口进行替换。
torch_npu.one_(self) -> Tensor
用1填充self张量。
“self” (Tensor):输入张量。
>>> x = torch.rand(2, 3).npu() >>> x tensor([[0.6072, 0.9726, 0.3475], [0.3717, 0.6135, 0.6788]], device='npu:0') >>> x.one_() tensor([[1., 1., 1.], [1., 1., 1.]], device='npu:0')