Pytorch Torch Absolute
# PyTorch torch.absolute Function
* * Pytorch torch Reference Manual](#)
`torch.absolute` is a function in PyTorch used to compute element-wise absolute values, with the same functionality as `torch.abs`.
### Function Definition
torch.absolute(input, out=None)
* * *
## Usage Example
## Example
import torch
# Create tensor containing negative numbers
x = torch.tensor([-1.0, -2.0,3.0, -4.0])
# Compute absolute value
result = torch.absolute(x)
print(result)
Output result:
tensor([1., 2., 3., 4.])
* * Pytorch torch Reference Manual](#)
YouTip