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

Squares each input in the tensor.

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.

square: tensor

The element wise square of the input tensor.


>>> import pytaco as pt
>>> pt.tensor_square([1, -2, 7], out_format=pt.dense).toarray()
array([ 1,  4, 49], dtype=int64)