full

nvtripy.full(shape: Sequence[int | DimensionSize], value: Tensor | Number, dtype: dtype = float32) Tensor[source]

Returns a tensor of the desired shape with all values set to the specified value.

Parameters:
  • shape (Sequence[int | DimensionSize]) – The desired shape.

  • value (Tensor | Number) – A scalar value to fill the resulting tensor.

  • dtype (dtype) – The desired data type.

Returns:

A tensor of shape shape.

Return type:

Tensor

INPUT REQUIREMENTS:
OUTPUT GUARANTEES:

return[0].dtype == dtype

Example
1output = tp.full(shape=[2, 3], value=2)
Local Variables
>>> output
tensor(
    [[2, 2, 2],
     [2, 2, 2]], 
    dtype=float32, loc=gpu:0, shape=(2, 3))