full¶
- tripy.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) – [dtype=T1] The desired data type.
- Returns:
[dtype=T1] A tensor of shape
shape
.- Return type:
Example
1output = tp.full(shape=[2, 3], value=2)
>>> output tensor( [[2.0000, 2.0000, 2.0000], [2.0000, 2.0000, 2.0000]], dtype=float32, loc=gpu:0, shape=(2, 3))