tilus.ir.RegisterTensor¶
- class tilus.ir.RegisterTensor[source]¶
A tensor that resides in the register memory.
- shape¶
The shape of the tensor.
- Type:
tuple[int, …]
- optional_layout¶
The layout of the tensor, which is optional. When not provided, the layout will be automatically inferred with compiler pass.
- Type:
Optional[RegisterLayout]
- __add__(other)[source]¶
Perform addition with another tensor or a scalar.
- Parameters:
other (RegisterTensor | int | float | Expr) – The tensor or scalar to add to this tensor.
- Returns:
ret – A new tensor that is the result of the addition.
- Return type:
- __mul__(other)[source]¶
Perform multiplication with another tensor or a scalar.
- Parameters:
other (RegisterTensor | int | float | Expr) – The tensor or scalar to multiply with this tensor.
- Returns:
ret – A new tensor that is the result of the multiplication.
- Return type:
- __sub__(other)[source]¶
Perform subtraction with another tensor or a scalar.
- Parameters:
other (RegisterTensor | int | float | Expr) – The tensor or scalar to subtract from this tensor.
- Returns:
ret – A new tensor that is the result of the subtraction.
- Return type:
- __truediv__(other)[source]¶
Perform division with another tensor or a scalar.
- Parameters:
other (RegisterTensor | int | float | Expr) – The tensor or scalar to divide this tensor by.
- Returns:
ret – A new tensor that is the result of the division.
- Return type:
- static create(dtype, *, shape, optional_layout=None)[source]¶
Create a RegisterTensor with the given dtype, shape, and optional layout.
- Parameters:
dtype (DataType) – The data type of the tensor elements.
shape (Sequence[int]) – The shape of the tensor.
optional_layout (RegisterLayout, optional) – The layout of the tensor. If not provided, the layout will be inferred later.
- Returns:
ret – The created RegisterTensor instance.
- Return type:
- property layout: RegisterLayout¶
Get the layout of the RegisterTensor.
- Returns:
ret – The layout of the RegisterTensor.
- Return type:
- Raises:
ValueError – If the layout of the RegisterTensor is not defined yet.
- squeeze(dim)[source]¶
Squeeze the tensor by removing dimensions of size 1.
- Parameters:
dim (int | Sequence[int]) – The dimension(s) to squeeze. If an integer is provided, it will squeeze that specific dimension. If a sequence of integers is provided, it will squeeze all specified dimensions.
- Returns:
ret – A new tensor with the specified dimensions squeezed.
- Return type:
See also