tilus.Script.view¶
- Script.view(x, *, layout=None, dtype=None)[source]¶
View register tensor with a different layout or data type.
This instruction allows you to reinterpret a register tensor with a different layout or data type without changing its underlying data.
The layout parameter specifies the new layout of the register tensor, while the dtype parameter specifies the new data type.
There is a requirement for the layout and dtype parameters:
x.dtype.nbits * x.layout.local_size == dtype.nbits * layout.local_size
This means that the total number of bits stored in each thread must remain the same after reinterpretation.
- Parameters:
x (RegisterTensor) – The register tensor to reinterpret.
layout (RegisterLayout, optional) – The new layout of the register tensor. If not provided, the layout will remain unchanged.
dtype (DataType, optional) – The new data type of the register tensor. If not provided, the data type will remain unchanged.
- Returns:
ret – The register tensor with the specified layout and/or data type.
- Return type: