asc2.full_like
- asc2.full_like(input: ~asc.language.tile.local_tensor.LocalTensor, value: ~asc.language.core.ir_value.PlainValue | int | float, location: ~asc._C.libpyasc.ir.TensorLocation = <TensorLocation.UB: 26>) LocalTensor
Create a tensor filled with a scalar value, with the same shape and dtype as the input tensor.
The supported data types are:
int8,int16,int32,int64,float16,bfloat16,float32.- Parameters:
input – The input tensor to match shape and dtype.
value – The scalar value to fill the tensor with.
location – The memory location for the tensor. Default is
TensorLocation.UB.
- Returns:
A new tensor filled with the specified value
- Return type:
- Raises:
TypeError – If input is not a LocalTensor
Examples
Create a tensor filled with a value, matching another tensor’s shape and dtype:
src = asc2.copy_in(x_gm, [0], [128]) result = asc2.full_like(src, 255)