asc.experimental.asctile.full
- asc.experimental.asctile.full(shape: Iterable[int], value: PlainValue | int | float, dtype: DataType | None = None) LocalTensor
Create a tensor filled with a scalar value.
The supported data types are:
int8,int16,int32,int64,float16,bfloat16,float32.- Parameters:
shape – The shape of the tensor to create.
value – The scalar value to fill the tensor with.
dtype – The data type of the tensor. If None, inferred from the value type.
- Returns:
A new tensor filled with the specified value
- Return type:
- Raises:
TypeError – If value is not a numeric type or dtype is not a DataType
RuntimeError – If shape is invalid or dtype is not supported
Examples
Create a tensor filled with a constant integer value:
result = asctile.full([128], 42, dtype=asctile.int32)
Create a tensor filled with a floating-point value:
result = asctile.full([32, 16], 3.14, dtype=asctile.float16)
Create a tensor with dtype inferred from the value:
result = asctile.full([64], 0) # inferred as int32 result = asctile.full([64], 1.5) # inferred as float32