pytaco.tensor_abs
- pytaco.tensor_abs(t1, out_format, dtype=None)
Calculates the element wise absolute value on the input tensor.
The tensor class implements
__abs__
using this method.- Parameters
- t1: tensor, array_like
input tensor or array_like object
- out_format: format, mode_format, optional
If a
format
is specified, the result tensor is stored in the format out_format.If a
mode_format
is specified, the result the result tensor has a with all of the dimensions stored in themode_format
passed in.
- dtype: Datatype
The datatype of the output tensor.
- Returns
- abs: tensor
The element wise absolute value of the input tensor.
Examples
>>> import pytaco as pt >>> pt.tensor_abs([1, -2], out_format=pt.dense).toarray() array([1, 2], dtype=int64)