PyTorch torch.sqrt function
PyTorch torch reference manual
torch.sqrt is a function in PyTorch used to compute the element-wise square root of a tensor.
Function definition
torch.sqrt(input, out=None)
Usage examples
Example
import
torch
x
=
torch.
tensor
(
[
4.0
,
9.0
,
16.0
,
25.0
]
)
y
=
torch.
sqrt
(
x
)
(
y
)
The output is:
tensor([2., 3., 4., 5.])