tilus.ir.SharedTensor

class tilus.ir.SharedTensor[source]

A tensor that resides in the shared memory.

dtype

The data type of the tensor elements.

Type:

DataType

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:

SharedLayout, optional

property layout: SharedLayout

Get the layout of the SharedTensor.

This property returns the layout of the SharedTensor. If the layout is not defined, it raises a ValueError.

Returns:

ret – The layout of the SharedTensor.

Return type:

SharedLayout

Raises:

ValueError – If the SharedTensor does not have a layout defined.

property size: int

Get the size of the SharedTensor.

This property returns the storage size of the tensor as an expression, in the unit of number of elements. If the SharedTensor is not compact, it may not be equal to the product of the shape dimensions.

Returns:

ret – The size of the SharedTensor, which is the number of elements it contains.

Return type:

int