PyTorch torch.square Function
Pytorch torch Reference Manual
torch.squareIt is a function in PyTorch used to compute the element-wise square.
Function Definition
torch.square(input, out=None)
Usage Example
Example
import torch
# Compute element-wise square
x = torch.tensor([1.0, 2.0, 3.0])
result = torch.square(x)
print(result)
# Compute element-wise square
x = torch.tensor([1.0, 2.0, 3.0])
result = torch.square(x)
print(result)
Other Extensions