full_like¶
- tripy.full_like(input: Tensor, value: Tensor | Number, dtype: dtype | None = None) Tensor [source]¶
Returns a tensor of the same shape and data type as the input tensor, with all values set to the specified value.
- Parameters:
- Returns:
[dtype=T2] A tensor of the same shape and data type (unless
dtype
is provided) as the input.- Return type:
- TYPE CONSTRAINTS:
Example
1input = tp.Tensor([[1, 2], [3, 4]]) 2output = tp.full_like(input, value=2)
>>> input tensor( [[1, 2], [3, 4]], dtype=int32, loc=gpu:0, shape=(2, 2)) >>> output tensor( [[2, 2], [2, 2]], dtype=int32, loc=gpu:0, shape=(2, 2))