Shortcuts

torch.rsqrt

torch.rsqrt(input, *, out=None) → Tensor

Returns a new tensor with the reciprocal of the square-root of each of the elements of input.

outi=1inputi\text{out}_{i} = \frac{1}{\sqrt{\text{input}_{i}}}
Parameters

input (Tensor) – the input tensor.

Keyword Arguments

out (Tensor, optional) – the output tensor.

Example:

>>> a = torch.randn(4)
>>> a
tensor([-0.0370,  0.2970,  1.5420, -0.9105])
>>> torch.rsqrt(a)
tensor([    nan,  1.8351,  0.8053,     nan])

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources