Supported LiteRT Ops#
The following TFLite op types have a built-in converter in
yobx.litert.ops. The list is generated programmatically
from the live converter registry.
<<<
import re
from yobx.litert import register_litert_converters
from yobx.litert.register import LITERT_OP_CONVERTERS
from yobx.litert.litert_helper import builtin_op_name
register_litert_converters()
PATTERN = re.compile(r"TFLite\s+``(\w+)``\s+→\s+ONNX\s+(.+)")
MODULE_LABELS = {
"yobx.litert.ops.activations": "Activations",
"yobx.litert.ops.elementwise": "Element-wise",
"yobx.litert.ops.nn_ops": "Neural network",
"yobx.litert.ops.reshape_ops": "Shape / tensor manipulation",
}
MODULE_ORDER = list(MODULE_LABELS.keys())
groups = {m: [] for m in MODULE_ORDER}
for code, fn in LITERT_OP_CONVERTERS.items():
mod = fn.__module__
doc = (fn.__doc__ or "").strip().splitlines()[0].strip().rstrip(".")
m = PATTERN.match(doc)
tflite_op = (
m.group(1) if m else (builtin_op_name(code) if isinstance(code, int) else code)
)
onnx_op = m.group(2).rstrip(".") if m else "?"
if mod in groups:
groups[mod].append((tflite_op, onnx_op))
for mod in MODULE_ORDER:
label = MODULE_LABELS[mod]
items = sorted(groups[mod])
if not items:
continue
print(f"**{label}**")
print()
for tflite_op, onnx_op in items:
print(f"* ``{tflite_op}`` → {onnx_op}")
print()
>>>
Activations
ELU→Elu(alpha=1.0)GELU→GeluHARD_SWISH→HardSwishLEAKY_RELU→LeakyReluLOG_SOFTMAX→LogSoftmax(axis=-1)RELU→ReluRELU_N1_TO_1→Clip(min=-1, max=1)SOFTMAX→Softmax(axis=-1)TANH→Tanh
Element-wise
ABS→AbsADD→AddCEIL→CeilDIV→DivEXP→ExpFLOOR→FloorFLOOR_DIV→Floor(Div(a, b))LOG→LogLOGICAL_AND→AndLOGICAL_NOT→NotLOGICAL_OR→OrMUL→MulNEG→NegPOW→PowROUND→RoundRSQRT→Reciprocal(Sqrt(x))SIN→SinSQRT→SqrtSQUARED_DIFFERENCE→Pow(Sub(a, b), 2)SUB→Sub
Neural network
AVERAGE_POOL_2D→AveragePoolBATCH_MATMUL→MatMulwith optional transposesCONV_2D→ConvDEPTHWISE_CONV_2D→Convwithgroup=in_channelsFULLY_CONNECTED→MatMul(+ optionalAddbias)MAX_POOL_2D→MaxPool
Shape / tensor manipulation
CONCATENATION→ConcatEXPAND_DIMS→UnsqueezeMEAN→ReduceMeanREDUCE_MAX→ReduceMaxREDUCE_MIN→ReduceMinRESHAPE→ReshapeSQUEEZE→SqueezeSUM→ReduceSumTRANSPOSE→Transpose