torch.rsqrt:
代码示例:
import torch
a=torch.tensor([1.,2.,3.,4.])
print("a:",a)
b=torch.rsqrt(a)
print("b:",b)
输出:
a: tensor([1., 2., 3., 4.])
b: tensor([1.0000, 0.7071, 0.5774, 0.5000])
torch.rsqrt:
代码示例:
import torch
a=torch.tensor([1.,2.,3.,4.])
print("a:",a)
b=torch.rsqrt(a)
print("b:",b)
输出:
a: tensor([1., 2., 3., 4.])
b: tensor([1.0000, 0.7071, 0.5774, 0.5000])