OperatorView
PythonOne generated operator, as ConversionResult.operators lists them in execution order.
OperatorView( layer_index: int, symbol: str, type: str, source_indices: tuple[int, ...], input_ids: tuple[str, ...], output_ids: tuple[str, ...], local_tensor_ids: tuple[str, ...], kernel_calls: Mapping[str, str] | None, macs: int | None, parameters: int | None,) -> Nonedataclass
One generated operator, as ConversionResult.operators lists them in execution order.
With module.schedule: table, the generated operator callback reports
run_started and run_finished for the operators in this order, and
its op argument is the operator’s layer_index.
layer_index
Pythonlayer_index: intThe operator’s position in execution order, from 0; its
index in ConversionResult.operators.
symbol
Pythonsymbol: strThe name the operator’s generated code is built from,
<prefix>_<type>_<id>: its _init and _run functions,
where the module emits them, and its source files.
type
Pythontype: strThe operator type: the name of its operator in the model file,
a LiteRT builtin operator name such as CONV_2D or LESS, or
a custom operator’s canonical key. A transform that rewrites an
operator reports the type it generates, so a depthwise convolution
that DEPTHWISE_TO_CONV rewrites is CONV_2D.
source_indices
Pythonsource_indices: tuple[int, ...]The index of the operator in the model file that the
operator was parsed from, in the converted subgraph. A fused
activation is part of its LiteRT operator and adds no index. A
transform that rewrites an operator keeps its index; an operator a
transform removes, as FOLD_STATIC_SHAPE_EXPRESSIONS removes
shape arithmetic, appears in no entry, and one a transform creates
has none. A LiteRT model hook that reorders the subgraph or
returns a copy of the model keeps every index. An operator a hook
creates lists the indices the hook states for it: each rolled-GRU
fusion states its own WHILE loop and the reshapes around it.
An operator a hook creates without stating any, or rebuilds from
the serialized model, has none.
input_ids
Pythoninput_ids: tuple[str, ...]The ids of the tensors the operator reads, in operand order.
output_ids
Pythonoutput_ids: tuple[str, ...]The ids of the tensors the operator writes, in operand order.
local_tensor_ids
Pythonlocal_tensor_ids: tuple[str, ...]The ids of the operator’s own tensors, as lowered:
weights, biases, quantization parameters, precomputed sums and
scratch buffers. Each id appears once and none is in input_ids
or output_ids; the order is not promised.
kernel_calls
Pythonkernel_calls: Mapping[str, str] | NoneEach heliaCORE function the operator’s generated code
calls, keyed by its role, such as run; empty for an operator
that calls none, or None when the operator does not record its
calls.
macs
Pythonmacs: int | NoneMultiply-accumulates per inference, a fused activation not
counted, or None for an operator type with no defined count:
CONV_2D, DEPTHWISE_CONV_2D and FULLY_CONNECTED count
one per weight for each output row (the output’s elements over its
last dimension), padded positions included; TRANSPOSE_CONV,
and a CONV_2D rewritten from one, one per weight for each
input row; BATCH_MATMUL one per output element for each
element of the contracted dimension; AVERAGE_POOL_2D and
MAX_POOL_2D count 0; every other type is None.
parameters
Pythonparameters: int | NoneThe elements of the operator’s constant weights and bias
(a BATCH_MATMUL’s constant operands), as the model holds them
before lowering repacks or folds them, a weight a DEQUANTIZE
of a constant produces counted as that constant; None where
macs is, and 0 for the pooling types.