yobx.litert.ops.nn_ops#
Converters for TFLite neural network ops: FULLY_CONNECTED, CONV_2D, DEPTHWISE_CONV_2D, AVERAGE_POOL_2D, MAX_POOL_2D, BATCH_MATMUL.
- yobx.litert.ops.nn_ops.convert_avg_pool2d(g: GraphBuilderExtendedProtocol, sts: Dict[str, Any], outputs: List[str], op: TFLiteOperator) str[source]#
TFLite
AVERAGE_POOL_2D→ ONNXAveragePool.
- yobx.litert.ops.nn_ops.convert_batch_matmul(g: GraphBuilderExtendedProtocol, sts: Dict[str, Any], outputs: List[str], op: TFLiteOperator) str[source]#
TFLite
BATCH_MATMUL→ ONNXMatMulwith optional transposes.
- yobx.litert.ops.nn_ops.convert_conv2d(g: GraphBuilderExtendedProtocol, sts: Dict[str, Any], outputs: List[str], op: TFLiteOperator) str[source]#
TFLite
CONV_2D→ ONNXConv.TFLite weight layout:
(out_ch, kH, kW, in_ch)— convert to ONNX(out_ch, in_ch, kH, kW)via aTranspose. TFLite input/output layout:NHWC— wrapped withTransposenodes to present asNCHWto the ONNXConvnode.
- yobx.litert.ops.nn_ops.convert_depthwise_conv2d(g: GraphBuilderExtendedProtocol, sts: Dict[str, Any], outputs: List[str], op: TFLiteOperator) str[source]#
TFLite
DEPTHWISE_CONV_2D→ ONNXConvwithgroup=in_channels.TFLite weight layout:
(1, kH, kW, out_ch)— for a depthwise conv with one filter per input channel, the number of groups equals the number of input channels. ONNX expects(out_ch, 1, kH, kW)for a grouped conv.
- yobx.litert.ops.nn_ops.convert_fully_connected(g: GraphBuilderExtendedProtocol, sts: Dict[str, Any], outputs: List[str], op: TFLiteOperator) str[source]#
TFLite
FULLY_CONNECTED→ ONNXMatMul(+ optionalAddbias).TFLite stores the weight matrix in (out_features, in_features) order so we transpose it to get the standard ONNX layout.
- yobx.litert.ops.nn_ops.convert_max_pool2d(g: GraphBuilderExtendedProtocol, sts: Dict[str, Any], outputs: List[str], op: TFLiteOperator) str[source]#
TFLite
MAX_POOL_2D→ ONNXMaxPool.