zeros

tripy.zeros(shape: tripy.types.ShapeLike, dtype: dtype = float32) Tensor[source]

Creates a Tensor of the specified shape and dtype with all elements set to 0.

Parameters:
  • shape (tripy.types.ShapeLike) – The desired shape of the tensor.

  • dtype (dtype) – [dtype=T1] Datatype of elements.

Returns:

[dtype=T1] A tensor of shape shape with all elements set to 0.

Return type:

Tensor

TYPE CONSTRAINTS:
Example
Example
1output = tp.zeros([2, 3])
>>> output
tensor(
    [[0.0000, 0.0000, 0.0000],
     [0.0000, 0.0000, 0.0000]], 
    dtype=float32, loc=gpu:0, shape=(2, 3))

See also

zeros_like(), full()