torch.rsqrt
- torch.rsqrt(input, *, out=None) → Tensor
-
返回一个新张量,其中每个元素是中对应元素平方根的倒数。
$\text{out}_{i} = \frac{1}{\sqrt{\text{input}_{i}}}$示例:
>>> a = torch.randn(4) >>> a tensor([-0.0370, 0.2970, 1.5420, -0.9105]) >>> torch.rsqrt(a) tensor([ nan, 1.8351, 0.8053, nan])