pytaco.tensor_exp

pytaco.tensor_exp(t1, out_format, dtype=None)

Takes the exp of each input in the tensor.

Note that this is applied to all elements in the tensor not just non-zeros. It is highly advised to store the output of this function in a dense format.

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 the mode_format passed in.

dtype: Datatype

The datatype of the output tensor.

Returns
exp: tensor

The element wise exp of the input tensor.

Examples

Note in the example below, the function is performed on the implicit 0s even after they are removed.

>>> import pytaco as pt
>>> t = pt.remove_explicit_zeros([4, -16, 0, 0], pt.compressed)
>>> pt.tensor_exp(t, out_format=pt.compressed, dtype=pt.int32).to_array()
array([54,  0,  1,  1], dtype=int32)