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 nbytes: int

The total size of the tensor in bytes (size * dtype_bytes).

property size: int

Get the number of elements in the shared tensor.

Returns:

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

Return type:

int