yobx.litert.register#
Op converter registry for the LiteRT→ONNX converter.
The registry maps BuiltinOperator
integer codes to converter callables. Use the
register_litert_op_converter() decorator to register a new converter:
from yobx.litert.register import register_litert_op_converter
from yobx.litert.litert_helper import BuiltinOperator
@register_litert_op_converter(BuiltinOperator.RELU)
def convert_relu(g, sts, outputs, op):
return g.op.Relu(outputs[0] + "_input", outputs=outputs, name="relu")
- yobx.litert.register.get_litert_op_converter(op_code: int | str) Callable | None[source]#
Return the registered converter for op_code, or
Noneif absent.
- yobx.litert.register.get_litert_op_converters() Dict[int | str, Callable][source]#
Return a copy of the full registry dictionary.
- yobx.litert.register.register_litert_op_converter(op_code: int | str | Tuple[int | str, ...])[source]#
Decorator that registers a converter for one or more TFLite op codes.
- Parameters:
op_code – a single
BuiltinOperatorinteger, a custom-op name string, or a tuple of those.- Raises:
TypeError – if an op code already has a registered converter.