user@483ed1a48e83:/workdir$ onnx2tf -i ts_ad_model.onnx -prf param_repl.json Model optimizing started ============================================================ Simplifying... Finish! Here is the difference: ┏━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ ┃ ┃ Original Model ┃ Simplified Model ┃ ┡━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ │ Add │ 2 │ 2 │ │ BatchNormalization │ 2 │ 2 │ │ Conv │ 3 │ 3 │ │ ConvTranspose │ 3 │ 3 │ │ MatMul │ 2 │ 2 │ │ ReduceMean │ 1 │ 1 │ │ Relu │ 5 │ 5 │ │ Reshape │ 1 │ 1 │ │ Squeeze │ 1 │ 1 │ │ Model Size │ 1.2MiB │ 1.2MiB │ └────────────────────┴────────────────┴──────────────────┘ Simplifying... Finish! Here is the difference: ┏━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ ┃ ┃ Original Model ┃ Simplified Model ┃ ┡━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ │ Add │ 2 │ 2 │ │ BatchNormalization │ 2 │ 2 │ │ Conv │ 3 │ 3 │ │ ConvTranspose │ 3 │ 3 │ │ MatMul │ 2 │ 2 │ │ ReduceMean │ 1 │ 1 │ │ Relu │ 5 │ 5 │ │ Reshape │ 1 │ 1 │ │ Squeeze │ 1 │ 1 │ │ Model Size │ 1.2MiB │ 1.2MiB │ └────────────────────┴────────────────┴──────────────────┘ Simplifying... Finish! Here is the difference: ┏━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ ┃ ┃ Original Model ┃ Simplified Model ┃ ┡━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ │ Add │ 2 │ 2 │ │ BatchNormalization │ 2 │ 2 │ │ Conv │ 3 │ 3 │ │ ConvTranspose │ 3 │ 3 │ │ MatMul │ 2 │ 2 │ │ ReduceMean │ 1 │ 1 │ │ Relu │ 5 │ 5 │ │ Reshape │ 1 │ 1 │ │ Squeeze │ 1 │ 1 │ │ Model Size │ 1.2MiB │ 1.2MiB │ └────────────────────┴────────────────┴──────────────────┘ Model optimizing complete! Automatic generation of each OP name started ======================================== Automatic generation of each OP name complete! Model loaded ======================================================================== Model convertion started ============================================================ INFO: input_op_name: onnx__Reshape_0 shape: [1, 64] dtype: float32 INFO: onnx_op_type: Reshape onnx_op_name: Reshape_1 INFO: input_name.1: onnx__Reshape_0 shape: [1, 64] dtype: float32 INFO: input_name.2: onnx::Reshape_37 shape: [3] dtype: INFO: output_name.1: input shape: [1, 1, 64] dtype: float32 INFO: tf_op_type: reshape INFO: input.1.tensor: name: tf.compat.v1.transpose/transpose:0 shape: (1, 64) dtype: INFO: input.2.shape: val: [-1, 1, 64] INFO: output.1.output: name: tf.reshape/Reshape:0 shape: (1, 1, 64) dtype: INFO: onnx_op_type: Conv onnx_op_name: Conv_2 INFO: input_name.1: input shape: [1, 1, 64] dtype: float32 INFO: input_name.2: onnx::Conv_65 shape: [64, 1, 9] dtype: INFO: input_name.3: onnx::Conv_66 shape: [64] dtype: INFO: output_name.1: input.7 shape: [1, 64, 64] dtype: float32 INFO: tf_op_type: convolution_v2 INFO: input.1.input: name: tf.compat.v1.transpose_1/transpose:0 shape: (1, 64, 1) dtype: INFO: input.2.weights: shape: (9, 1, 64) dtype: float32 INFO: input.3.bias: shape: (64,) dtype: float32 INFO: input.4.strides: val: [1] INFO: input.5.dilations: val: [1] INFO: input.6.padding: val: SAME INFO: input.7.group: val: 1 INFO: output.1.output: name: tf.math.add/Add:0 shape: (1, 64, 64) dtype: INFO: onnx_op_type: Relu onnx_op_name: Relu_3 INFO: input_name.1: input.7 shape: [1, 64, 64] dtype: float32 INFO: output_name.1: input.11 shape: [1, 64, 64] dtype: float32 INFO: tf_op_type: relu INFO: input.1.features: name: tf.math.add/Add:0 shape: (1, 64, 64) dtype: INFO: output.1.output: name: tf.nn.relu/Relu:0 shape: (1, 64, 64) dtype: INFO: onnx_op_type: Conv onnx_op_name: Conv_4 INFO: input_name.1: input.11 shape: [1, 64, 64] dtype: float32 INFO: input_name.2: onnx::Conv_68 shape: [128, 64, 5] dtype: INFO: input_name.3: onnx::Conv_69 shape: [128] dtype: INFO: output_name.1: input.19 shape: [1, 128, 64] dtype: float32 INFO: tf_op_type: convolution_v2 INFO: input.1.input: name: tf.nn.relu/Relu:0 shape: (1, 64, 64) dtype: INFO: input.2.weights: shape: (5, 64, 128) dtype: float32 INFO: input.3.bias: shape: (128,) dtype: float32 INFO: input.4.strides: val: [1] INFO: input.5.dilations: val: [1] INFO: input.6.padding: val: SAME INFO: input.7.group: val: 1 INFO: output.1.output: name: tf.math.add_1/Add:0 shape: (1, 64, 128) dtype: INFO: onnx_op_type: Relu onnx_op_name: Relu_5 INFO: input_name.1: input.19 shape: [1, 128, 64] dtype: float32 INFO: output_name.1: input.23 shape: [1, 128, 64] dtype: float32 INFO: tf_op_type: relu INFO: input.1.features: name: tf.math.add_1/Add:0 shape: (1, 64, 128) dtype: INFO: output.1.output: name: tf.nn.relu_1/Relu:0 shape: (1, 64, 128) dtype: INFO: onnx_op_type: Conv onnx_op_name: Conv_6 INFO: input_name.1: input.23 shape: [1, 128, 64] dtype: float32 INFO: input_name.2: onnx::Conv_71 shape: [256, 128, 3] dtype: INFO: input_name.3: onnx::Conv_72 shape: [256] dtype: INFO: output_name.1: input.31 shape: [1, 256, 66] dtype: float32 INFO: tf_op_type: convolution_v2 INFO: input.1.input: name: tf.compat.v1.pad/Pad:0 shape: (1, 68, 128) dtype: INFO: input.2.weights: shape: (3, 128, 256) dtype: float32 INFO: input.3.bias: shape: (256,) dtype: float32 INFO: input.4.strides: val: [1] INFO: input.5.dilations: val: [1] INFO: input.6.padding: val: VALID INFO: input.7.group: val: 1 INFO: output.1.output: name: tf.math.add_2/Add:0 shape: (1, 66, 256) dtype: INFO: onnx_op_type: Relu onnx_op_name: Relu_7 INFO: input_name.1: input.31 shape: [1, 256, 66] dtype: float32 INFO: output_name.1: input.35 shape: [1, 256, 66] dtype: float32 INFO: tf_op_type: relu INFO: input.1.features: name: tf.math.add_2/Add:0 shape: (1, 66, 256) dtype: INFO: output.1.output: name: tf.nn.relu_2/Relu:0 shape: (1, 66, 256) dtype: INFO: onnx_op_type: MatMul onnx_op_name: MatMul_8 INFO: input_name.1: input.35 shape: [1, 256, 66] dtype: float32 INFO: input_name.2: onnx::MatMul_73 shape: [66, 2] dtype: INFO: output_name.1: onnx::Add_49 shape: [1, 256, 2] dtype: float32 INFO: tf_op_type: matmul INFO: input.1.a: name: tf.compat.v1.transpose_2/transpose:0 shape: (1, 256, 66) dtype: INFO: input.2.b: shape: (66, 2) dtype: float32 INFO: input.3.output_type: name: float32 shape: () INFO: output.1.output: name: tf.linalg.matmul/MatMul:0 shape: (1, 256, 2) dtype: INFO: onnx_op_type: Add onnx_op_name: Add_9 INFO: input_name.1: encoder.linear1.bias shape: [2] dtype: INFO: input_name.2: onnx::Add_49 shape: [1, 256, 2] dtype: float32 INFO: output_name.1: onnx::MatMul_50 shape: [1, 256, 2] dtype: float32 INFO: tf_op_type: add INFO: input.1.x: name: tf.linalg.matmul/MatMul:0 shape: (1, 256, 2) dtype: INFO: input.2.y: shape: (2,) dtype: float32 INFO: output.1.output: name: tf.math.add_3/Add:0 shape: (1, 256, 2) dtype: INFO: onnx_op_type: MatMul onnx_op_name: MatMul_10 INFO: input_name.1: onnx::MatMul_50 shape: [1, 256, 2] dtype: float32 INFO: input_name.2: onnx::MatMul_74 shape: [2, 66] dtype: INFO: output_name.1: onnx::Add_52 shape: [1, 256, 66] dtype: float32 INFO: tf_op_type: matmul INFO: input.1.a: name: tf.math.add_3/Add:0 shape: (1, 256, 2) dtype: INFO: input.2.b: shape: (2, 66) dtype: float32 INFO: input.3.output_type: name: float32 shape: () INFO: output.1.output: name: tf.linalg.matmul_1/MatMul:0 shape: (1, 256, 66) dtype: INFO: onnx_op_type: Add onnx_op_name: Add_11 INFO: input_name.1: decoder.decoder_lin.0.bias shape: [66] dtype: INFO: input_name.2: onnx::Add_52 shape: [1, 256, 66] dtype: float32 INFO: output_name.1: onnx::ConvTranspose_53 shape: [1, 256, 66] dtype: float32 INFO: tf_op_type: add INFO: input.1.x: name: tf.linalg.matmul_1/MatMul:0 shape: (1, 256, 66) dtype: INFO: input.2.y: shape: (66,) dtype: float32 INFO: output.1.output: name: tf.compat.v1.transpose_3/transpose:0 shape: (1, 66, 256) dtype: INFO: onnx_op_type: ConvTranspose onnx_op_name: ConvTranspose_12 INFO: input_name.1: onnx::ConvTranspose_53 shape: [1, 256, 66] dtype: float32 INFO: input_name.2: decoder.deconv_block1.0.weight shape: [256, 128, 3] dtype: INFO: output_name.1: input.39 shape: [1, 128, 64] dtype: float32 INFO: tf_op_type: conv1d_transpose INFO: input.1.input: name: tf.compat.v1.transpose_3/transpose:0 shape: (1, 66, 256) dtype: INFO: input.2.filters: shape: (3, 128, 256) dtype: float32 INFO: input.3.output_shape: val: [1, 64, 128] INFO: input.4.strides: val: [1] INFO: input.5.dilations: val: [1] INFO: input.6.padding: val: VALID INFO: input.7.group: val: 1 INFO: input.8.bias: INFO: output.1.output: name: tf.slice/Slice:0 shape: (1, 64, 128) dtype: INFO: onnx_op_type: BatchNormalization onnx_op_name: BatchNormalization_13 INFO: input_name.1: input.39 shape: [1, 128, 64] dtype: float32 INFO: input_name.2: decoder.deconv_block1.1.weight shape: [128] dtype: INFO: input_name.3: decoder.deconv_block1.1.bias shape: [128] dtype: INFO: input_name.4: decoder.deconv_block1.1.running_mean shape: [128] dtype: INFO: input_name.5: decoder.deconv_block1.1.running_var shape: [128] dtype: INFO: output_name.1: input.43 shape: [1, 128, 64] dtype: float32 INFO: tf_op_type: BatchNormalization INFO: input.1.X: name: tf.slice/Slice:0 shape: (1, 64, 128) dtype: INFO: input.2.mean: name: decoder.deconv_block1.1.running_mean shape: (128,) dtype: INFO: input.3.variance: name: decoder.deconv_block1.1.running_var shape: (128,) dtype: INFO: input.4.offset: name: decoder.deconv_block1.1.bias shape: (128,) dtype: INFO: input.5.scale: name: decoder.deconv_block1.1.weight shape: (128,) dtype: INFO: input.6.variance_epsilon: val: 9.999999747378752e-06 INFO: output.1.output: name: tf.__operators__.add/AddV2:0 shape: (1, 64, 128) dtype: INFO: onnx_op_type: Relu onnx_op_name: Relu_14 INFO: input_name.1: input.43 shape: [1, 128, 64] dtype: float32 INFO: output_name.1: onnx::ConvTranspose_56 shape: [1, 128, 64] dtype: float32 INFO: tf_op_type: relu INFO: input.1.features: name: tf.__operators__.add/AddV2:0 shape: (1, 64, 128) dtype: INFO: output.1.output: name: tf.nn.relu_3/Relu:0 shape: (1, 64, 128) dtype: INFO: onnx_op_type: ConvTranspose onnx_op_name: ConvTranspose_15 INFO: input_name.1: onnx::ConvTranspose_56 shape: [1, 128, 64] dtype: float32 INFO: input_name.2: decoder.deconv_block2.0.weight shape: [128, 64, 5] dtype: INFO: output_name.1: input.47 shape: [1, 64, 64] dtype: float32 INFO: tf_op_type: conv1d_transpose INFO: input.1.input: name: tf.nn.relu_3/Relu:0 shape: (1, 64, 128) dtype: INFO: input.2.filters: shape: (5, 64, 128) dtype: float32 INFO: input.3.output_shape: val: [1, 64, 64] INFO: input.4.strides: val: [1] INFO: input.5.dilations: val: [1] INFO: input.6.padding: val: VALID INFO: input.7.group: val: 1 INFO: input.8.bias: INFO: output.1.output: name: tf.slice_1/Slice:0 shape: (1, 64, 64) dtype: INFO: onnx_op_type: BatchNormalization onnx_op_name: BatchNormalization_16 INFO: input_name.1: input.47 shape: [1, 64, 64] dtype: float32 INFO: input_name.2: decoder.deconv_block2.1.weight shape: [64] dtype: INFO: input_name.3: decoder.deconv_block2.1.bias shape: [64] dtype: INFO: input_name.4: decoder.deconv_block2.1.running_mean shape: [64] dtype: INFO: input_name.5: decoder.deconv_block2.1.running_var shape: [64] dtype: INFO: output_name.1: input.51 shape: [1, 64, 64] dtype: float32 INFO: tf_op_type: BatchNormalization INFO: input.1.X: name: tf.slice_1/Slice:0 shape: (1, 64, 64) dtype: INFO: input.2.mean: name: decoder.deconv_block2.1.running_mean shape: (64,) dtype: INFO: input.3.variance: name: decoder.deconv_block2.1.running_var shape: (64,) dtype: INFO: input.4.offset: name: decoder.deconv_block2.1.bias shape: (64,) dtype: INFO: input.5.scale: name: decoder.deconv_block2.1.weight shape: (64,) dtype: INFO: input.6.variance_epsilon: val: 9.999999747378752e-06 INFO: output.1.output: name: tf.__operators__.add_1/AddV2:0 shape: (1, 64, 64) dtype: INFO: onnx_op_type: Relu onnx_op_name: Relu_17 INFO: input_name.1: input.51 shape: [1, 64, 64] dtype: float32 INFO: output_name.1: onnx::ConvTranspose_59 shape: [1, 64, 64] dtype: float32 INFO: tf_op_type: relu INFO: input.1.features: name: tf.__operators__.add_1/AddV2:0 shape: (1, 64, 64) dtype: INFO: output.1.output: name: tf.nn.relu_4/Relu:0 shape: (1, 64, 64) dtype: INFO: onnx_op_type: ConvTranspose onnx_op_name: ConvTranspose_18 INFO: input_name.1: onnx::ConvTranspose_59 shape: [1, 64, 64] dtype: float32 INFO: input_name.2: decoder.deconv_last.weight shape: [64, 64, 9] dtype: INFO: input_name.3: decoder.deconv_last.bias shape: [64] dtype: INFO: output_name.1: onnx::ReduceMean_60 shape: [1, 64, 64] dtype: float32 INFO: tf_op_type: conv1d_transpose INFO: input.1.input: name: tf.nn.relu_4/Relu:0 shape: (1, 64, 64) dtype: INFO: input.2.filters: shape: (9, 64, 64) dtype: float32 INFO: input.3.output_shape: val: [1, 64, 64] INFO: input.4.strides: val: [1] INFO: input.5.dilations: val: [1] INFO: input.6.padding: val: VALID INFO: input.7.group: val: 1 INFO: input.8.bias: shape: (64,) dtype: float32 INFO: output.1.output: name: tf.slice_2/Slice:0 shape: (1, 64, 64) dtype: INFO: onnx_op_type: ReduceMean onnx_op_name: ReduceMean_19 INFO: input_name.1: onnx::ReduceMean_60 shape: [1, 64, 64] dtype: float32 INFO: output_name.1: onnx::Squeeze_61 shape: [1, 1, 64] dtype: float32 INFO: tf_op_type: reduce_mean INFO: input.1.axis0: val: 2 INFO: input.2.input_tensor: name: tf.slice_2/Slice:0 shape: (1, 64, 64) dtype: INFO: input.3.keepdims: val: True INFO: output.1.output: name: tf.math.reduce_mean/Mean:0 shape: (1, 64, 1) dtype: INFO: onnx_op_type: Squeeze onnx_op_name: Squeeze_21 INFO: input_name.1: onnx::Squeeze_61 shape: [1, 1, 64] dtype: float32 INFO: input_name.2: onnx::Squeeze_62 shape: [1] dtype: INFO: output_name.1: 63 shape: [1, 64] dtype: float32 INFO: tf_op_type: squeeze_v2 INFO: input.1.input: name: tf.math.reduce_mean/Mean:0 shape: (1, 64, 1) dtype: INFO: input.2.axis: val: [2] INFO: output.1.output: name: tf.compat.v1.squeeze_2/Squeeze_21:0 shape: (1, 64) dtype: Model: "model" ____________________________________________________________________________________________________________________________________________ Layer (type) Output Shape Param # ============================================================================================================================================ onnx__Reshape_0 (InputLayer) [(1, 64)] 0 tf.compat.v1.transpose (TFOpLambda) (1, 64) 0 tf.reshape (TFOpLambda) (1, 1, 64) 0 tf.compat.v1.transpose_1 (TFOpLambda) (1, 64, 1) 0 tf.compat.v1.nn.conv1d (TFOpLambda) (1, 64, 64) 0 tf.math.add (TFOpLambda) (1, 64, 64) 0 tf.nn.relu (TFOpLambda) (1, 64, 64) 0 tf.compat.v1.nn.conv1d_1 (TFOpLambda) (1, 64, 128) 0 tf.math.add_1 (TFOpLambda) (1, 64, 128) 0 tf.nn.relu_1 (TFOpLambda) (1, 64, 128) 0 tf.compat.v1.pad (TFOpLambda) (1, 68, 128) 0 tf.compat.v1.nn.conv1d_2 (TFOpLambda) (1, 66, 256) 0 tf.math.add_2 (TFOpLambda) (1, 66, 256) 0 tf.nn.relu_2 (TFOpLambda) (1, 66, 256) 0 tf.compat.v1.transpose_2 (TFOpLambda) (1, 256, 66) 0 tf.linalg.matmul (TFOpLambda) (1, 256, 2) 0 tf.math.add_3 (TFOpLambda) (1, 256, 2) 0 tf.linalg.matmul_1 (TFOpLambda) (1, 256, 66) 0 tf.math.add_4 (TFOpLambda) (1, 256, 66) 0 tf.compat.v1.transpose_3 (TFOpLambda) (1, 66, 256) 0 tf.nn.conv1d_transpose (TFOpLambda) (1, 68, 128) 0 tf.slice (TFOpLambda) (1, 64, 128) 0 tf.math.multiply (TFOpLambda) (1, 64, 128) 0 tf.__operators__.add (TFOpLambda) (1, 64, 128) 0 tf.nn.relu_3 (TFOpLambda) (1, 64, 128) 0 tf.nn.conv1d_transpose_1 (TFOpLambda) (1, 68, 64) 0 tf.slice_1 (TFOpLambda) (1, 64, 64) 0 tf.math.multiply_1 (TFOpLambda) (1, 64, 64) 0 tf.__operators__.add_1 (TFOpLambda) (1, 64, 64) 0 tf.nn.relu_4 (TFOpLambda) (1, 64, 64) 0 tf.nn.conv1d_transpose_2 (TFOpLambda) (1, 72, 64) 0 tf.math.add_5 (TFOpLambda) (1, 72, 64) 0 tf.slice_2 (TFOpLambda) (1, 64, 64) 0 tf.math.reduce_mean (TFOpLambda) (1, 64, 1) 0 tf.compat.v1.squeeze_2 (TFOpLambda) (1, 64) 0 ============================================================================================================================================ Total params: 0 Trainable params: 0 Non-trainable params: 0 ____________________________________________________________________________________________________________________________________________ saved_model output started ========================================================== saved_model output complete! WARNING:absl:Please consider providing the trackable_obj argument in the from_concrete_functions. Providing without the trackable_obj argument is deprecated and it will use the deprecated conversion path. Estimated count of arithmetic ops: 41.302 M ops, equivalently 20.651 M MACs Float32 tflite output complete! Estimated count of arithmetic ops: 41.302 M ops, equivalently 20.651 M MACs Float16 tflite output complete! user@483ed1a48e83:/workdir$ a