Script.tcgen05.slice

Script.tcgen05.slice

Script.tcgen05.slice(tensor, offsets, dims, shape)[source]

Create a sliced view of a tensor memory tensor.

Returns a new TMemoryTensor that refers to a sub-region of the original tensor. This is a metadata-only operation and does not copy data.

Parameters:
  • tensor (TMemoryTensor) – The source tensor memory tensor.

  • offsets (Sequence[Expr | int]) – The starting offsets for each dimension being sliced.

  • dims (Sequence[int]) – The dimensions along which to slice.

  • shape (Sequence[int]) – The shape of the resulting sliced tensor.

Returns:

ret – A new tensor memory tensor referencing the sliced sub-region.

Return type:

TMemoryTensor