PyTorch torch.arccos Function
Pytorch torch Reference ManualPytorch torch Reference Manual
torch.arccosis a function in PyTorch used to compute the element-wise arccosine, andtorch.acoshas the same functionality.
Function Definition
torch.arccos(input, out=None)
Usage Example
Example
import torch
# Create tensor
x = torch.tensor([-1.0, -0.5, 0.0, 0.5, 1.0])
# Compute arccosine
result = torch.arccos(x)
print(result)
# Create tensor
x = torch.tensor([-1.0, -0.5, 0.0, 0.5, 1.0])
# Compute arccosine
result = torch.arccos(x)
print(result)
The output result is:
tensor([3.1416, 2.0944, 1.5708, 1.0472, 0.0000])
Other Extensions