tvm_tirx.tirx.script.tensor_indices

Contents

tvm_tirx.tirx.script.tensor_indices#

tvm_tirx.tirx.script.tensor_indices(tensor, index)#

Translate logical flat or multidimensional indices for a concrete tensor.

A single index is unraveled in row-major logical order, retaining the outermost quotient. Explicit multidimensional coordinates pass through. The result indexes the original tensor, preserving its strides, layout, element offset and aliases; this function never creates a tensor view.

Parameters:
  • tensor (Var) – The concrete tensor whose logical shape determines the coordinates.

  • index (Expr or sequence of Expr) – A flat logical index or explicit multidimensional coordinates.

Returns:

indices (list of Expr) – Coordinates for a tensor load or an explicitly emitted tensor store.