PyTorch torch.sqrt Function


Pytorch torch 参考手册Pytorch torch Reference Manual

torch.sqrtis a function in PyTorch used to compute the element-wise square root of tensors.

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)
print(y)

The output result is:

tensor([2., 3., 4., 5.])

Pytorch torch 参考手册Pytorch torch Reference Manual

Other Extensions