(beta)torch_npu.one_
 
 该接口计划废弃,可以使用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')
父主题: torch_npu