Computes the absolute value of the tensor element-wise. ```python exec="true" source="above" session="tensor" result="python" print(Tensor([-3., -2., -1., 0., 1., 2., 3.]).abs().numpy()) ```
(self)
| 885 | return self.ne(0).where((self < 0).where(self.const_like(-1), self.const_like(1)), self.const_like(0)) |
| 886 | |
| 887 | def abs(self) -> Self: |
| 888 | """ |
| 889 | Computes the absolute value of the tensor element-wise. |
| 890 | |
| 891 | ```python exec="true" source="above" session="tensor" result="python" |
| 892 | print(Tensor([-3., -2., -1., 0., 1., 2., 3.]).abs().numpy()) |
| 893 | ``` |
| 894 | """ |
| 895 | return self * self.sign() |
| 896 | |
| 897 | def tan(self) -> Self: |
| 898 | """ |