tensorflow / models

Models and examples built with TensorFlow
Other
76.97k stars 45.79k forks source link

[TF2] [Object Detection API] Post training quantization for ssd models #9320

Open ItsMeTheBee opened 3 years ago

ItsMeTheBee commented 3 years ago

Prerequisites

Please answer the following question for yourself before submitting an issue.

1. The entire URL of the documentation with the issue

https://github.com/tensorflow/models/tree/master/research/...

2. Describe the issue

Hey all!

I´m quite sure I´m not on the right track yet which is why I opened this as a documentation issue but I still added some code and output just in case this helps anyone. I´ve trained a SSD MobileNet v2 and a SSD Resnet50_v1_fpn_640x640 to detect custom objects using the TF2 Object Detection API. Because I need to use the Coral Chip to run my models so I´ve been searching for some documentation on how to do post training quantization on models trained with TF2 Object Detection API or just how to get them to run on the Edge TPU in general. Unfortunately I´ve been unable to find anything that works with TF2.

The code I´ve tried (I did play around with the options a bit but since none of them worked I´ll just show you my current version):

import tensorflow as tf

TEST_DIR = "/home/sally/work/training/TensorFlow/workspace/images/test"
IMAGE_SIZE = 640

# A generator that provides a representative dataset
def representative_data_gen():
  dataset_list = tf.data.Dataset.list_files(TEST_DIR + '/*/*')
  for i in range(100):
    image = next(iter(dataset_list))
    image = tf.io.read_file(image)
    image = tf.io.decode_jpeg(image, channels=3)
    image = tf.image.resize(image, [IMAGE_SIZE, IMAGE_SIZE])
    image = tf.cast(image / 255., tf.float32)
    image = tf.expand_dims(image, 0)
    yield [image]

#converter = tf.lite.TFLiteConverter.from_keras_model(model)
converter = tf.lite.TFLiteConverter.from_saved_model('/home/sally/work/training/TensorFlow/workspace/training_demo/exported_models/my_ssd_mobilenet_v2/saved_model/',signature_keys=['serving_default'])
#converter.experimental_new_converter = False
# This enables quantization
converter.optimizations = [tf.lite.Optimize.DEFAULT]
# This sets the representative dataset for quantization
converter.representative_dataset = representative_data_gen
# This ensures that if any ops can't be quantized, the converter throws an error
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8]
# For full integer quantization, though supported types defaults to int8 only, we explicitly declare it for clarity.
converter.target_spec.supported_types = [tf.int8]
# These set the input and output tensors to uint8 (added in r2.3)
converter.inference_input_type = tf.uint8
converter.inference_output_type = tf.uint8
tflite_model = converter.convert()

with open('/home/sally/work/training/TensorFlow/workspace/training_demo/my_ssd_mobilenet_v2_quant.tflite', 'wb') as f:
  f.write(tflite_model)

I´m not sure if this is the correct way to build a representative dataset and if I should set converter.experimental_new_converter = False or not. Like this I´m getting a lot of letters and numbers as output and in the end this (only copied the end of the output because it´s really long):

tensor<320xf32>} : () -> tensor<320xf32>
  %cst_208 = "std.constant"() {value = dense<"0xBE44063DB371853B8DC58CBA0D97A93C7E0C0DBC46ACCA3B420FCF3B83D31CBB06D56D3CB79537BC4B3BA6BAD4E622BCDD659C3C377F9B3CE67D78BB36CE743DA32D03BCDA01BD3A054E56BAAC25C13BC4711E3CB7C9193DDD02143DCF0B77BBF2FA873BA78A15BCBC875ABC3D8B1EBC0184423CDE8691BCC680B43C9D8061BB52F4F23B84F813BCF599653D2E6D443CC2BB9B3C7985573B53FC653D3AFE133C2DF8123C2E227ABB920C41BB1FDED93B93C292BB886B343CAB6E28BB0832843CB068183C4AA83DBC95658CBA40F1CE3CC73DC03B62150BBB85D256BC335A833C0FB4C1394A3343BAA6526CBCA628393BC9A41A3C2445913C505126BC1A4EB53C94BE13BCA02C23BC3761AA3B1E9174BBE5F7803BECC38D3DDC5C4CBB961A8C3CB1D1233B4EC7543CDF0D0A3C954D2D3D97582E3C8B29203A328BA2BC2FFD3D3B9A4E133CBB433C3BB45175BC3D02133CAE5A873C562DB13C473570BCAF48ED3B6FE3ED3AABAB383D7F094E3D482E4B3CBC9D2DBDDF46033E2D87E23C1DF7C63CE7FDF73BB565CFBC919CF13A7039823C5EAEA33C0C6A683CDC62AEBB3A828B3B82D88B3BB387083C7594873C1433583DA2DBEBBBC858453D81DA4E3CA2B3F83B6B42513C60A7C73CD08B4FBC5C56123D1C8281BC010A283CC89F8ABCAA61E0392EF9F7BB6911E43B003F073CC016303C60ED95B9B35E9C3B5A5BA33C838D693C"> : tensor<128xf32>} : () -> tensor<128xf32>
  %cst_209 = "std.constant"() {value = dense<[-0.0376489125, 0.0156377964, 0.206393272, -0.23625426, -0.00636431715, -0.0161379576, 0.352772385, -0.389592469, 0.00376397721, -0.00135814748, 0.0129797952, -0.0155094909, -0.00167378725, -0.00865046214, 0.0450186841, -0.035979826, -0.0364775509, 0.0040444429, -0.193511665, 0.0637484342, 0.00465056254, 0.02928886, -0.192988843, 0.170921251]> : tensor<24xf32>} : () -> tensor<24xf32>
  %cst_210 = "std.constant"() {value = dense<[1, 51150, 1, 4]> : tensor<4xi32>} : () -> tensor<4xi32>
  %cst_211 = "std.constant"() {value = dense<[1, 51150, 4]> : tensor<3xi32>} : () -> tensor<3xi32>
  %cst_212 = "std.constant"() {value = dense<[-4.71933889, -4.59650373, -4.74164772, -4.60036802, -4.72730112, -4.68636799, -4.70434093, -4.7018795, -4.71999884, -4.60973263, -4.68627119, -4.49484301]> : tensor<12xf32>} : () -> tensor<12xf32>
  %cst_213 = "std.constant"() {value = dense<-1> : tensor<1xi32>} : () -> tensor<1xi32>
  %cst_214 = "std.constant"() {value = dense<0> : tensor<1xi32>} : () -> tensor<1xi32>
  %cst_215 = "std.constant"() {value = dense<2> : tensor<1xi32>} : () -> tensor<1xi32>
  %cst_216 = "std.constant"() {value = dense<1> : tensor<1xi32>} : () -> tensor<1xi32>
  %0 = "tfl.cast"(%arg0) : (tensor<1x?x?x3xui8>) -> tensor<1x?x?x3xf32>
  %1 = "tfl.mul"(%0, %cst_23) {fused_activation_function = "NONE"} : (tensor<1x?x?x3xf32>, tensor<f32>) -> tensor<1x?x?x3xf32>
  %2 = "tfl.sub"(%1, %cst_26) {fused_activation_function = "NONE"} : (tensor<1x?x?x3xf32>, tensor<f32>) -> tensor<1x?x?x3xf32>
  %3 = "tfl.unpack"(%2) {axis = 0 : i32, num = 1 : i32} : (tensor<1x?x?x3xf32>) -> tensor<?x?x3xf32>
  %4 = "tfl.expand_dims"(%3, %cst_21) : (tensor<?x?x3xf32>, tensor<i32>) -> tensor<1x?x?x3xf32>
  %5 = "tfl.resize_bilinear"(%4, %cst_22) {align_corners = false, half_pixel_centers = false} : (tensor<1x?x?x3xf32>, tensor<2xi32>) -> tensor<1x640x640x3xf32>
  %6 = "tfl.reshape"(%5, %cst_171) : (tensor<1x640x640x3xf32>, tensor<3xi32>) -> tensor<640x640x3xf32>
  %7 = "tfl.pack"(%6) {axis = 0 : i32, values_count = 1 : i32} : (tensor<640x640x3xf32>) -> tensor<1x640x640x3xf32>
  %8 = "tfl.conv_2d"(%7, %cst_96, %cst_37) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 2 : i32, stride_w = 2 : i32} : (tensor<1x640x640x3xf32>, tensor<32x3x3x3xf32>, tensor<32xf32>) -> tensor<1x320x320x32xf32>
  %9 = "tfl.depthwise_conv_2d"(%8, %cst_172, %cst_38) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x320x320x32xf32>, tensor<1x3x3x32xf32>, tensor<32xf32>) -> tensor<1x320x320x32xf32>
  %10 = "tfl.conv_2d"(%9, %cst_97, %cst_173) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x320x320x32xf32>, tensor<16x1x1x32xf32>, tensor<16xf32>) -> tensor<1x320x320x16xf32>
  %11 = "tfl.conv_2d"(%10, %cst_98, %cst_39) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x320x320x16xf32>, tensor<96x1x1x16xf32>, tensor<96xf32>) -> tensor<1x320x320x96xf32>
  %12 = "tfl.depthwise_conv_2d"(%11, %cst_174, %cst_40) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 2 : i32, stride_w = 2 : i32} : (tensor<1x320x320x96xf32>, tensor<1x3x3x96xf32>, tensor<96xf32>) -> tensor<1x160x160x96xf32>
  %13 = "tfl.conv_2d"(%12, %cst_99, %cst_175) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x160x160x96xf32>, tensor<24x1x1x96xf32>, tensor<24xf32>) -> tensor<1x160x160x24xf32>
  %14 = "tfl.conv_2d"(%13, %cst_100, %cst_41) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x160x160x24xf32>, tensor<144x1x1x24xf32>, tensor<144xf32>) -> tensor<1x160x160x144xf32>
  %15 = "tfl.depthwise_conv_2d"(%14, %cst_176, %cst_42) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x160x160x144xf32>, tensor<1x3x3x144xf32>, tensor<144xf32>) -> tensor<1x160x160x144xf32>
  %16 = "tfl.conv_2d"(%15, %cst_101, %cst_177) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x160x160x144xf32>, tensor<24x1x1x144xf32>, tensor<24xf32>) -> tensor<1x160x160x24xf32>
  %17 = "tfl.add"(%13, %16) {fused_activation_function = "NONE"} : (tensor<1x160x160x24xf32>, tensor<1x160x160x24xf32>) -> tensor<1x160x160x24xf32>
  %18 = "tfl.conv_2d"(%17, %cst_102, %cst_43) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x160x160x24xf32>, tensor<144x1x1x24xf32>, tensor<144xf32>) -> tensor<1x160x160x144xf32>
  %19 = "tfl.depthwise_conv_2d"(%18, %cst_178, %cst_44) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 2 : i32, stride_w = 2 : i32} : (tensor<1x160x160x144xf32>, tensor<1x3x3x144xf32>, tensor<144xf32>) -> tensor<1x80x80x144xf32>
  %20 = "tfl.conv_2d"(%19, %cst_103, %cst_179) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x144xf32>, tensor<32x1x1x144xf32>, tensor<32xf32>) -> tensor<1x80x80x32xf32>
  %21 = "tfl.conv_2d"(%20, %cst_104, %cst_45) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x32xf32>, tensor<192x1x1x32xf32>, tensor<192xf32>) -> tensor<1x80x80x192xf32>
  %22 = "tfl.depthwise_conv_2d"(%21, %cst_180, %cst_46) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x192xf32>, tensor<1x3x3x192xf32>, tensor<192xf32>) -> tensor<1x80x80x192xf32>
  %23 = "tfl.conv_2d"(%22, %cst_105, %cst_181) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x192xf32>, tensor<32x1x1x192xf32>, tensor<32xf32>) -> tensor<1x80x80x32xf32>
  %24 = "tfl.add"(%20, %23) {fused_activation_function = "NONE"} : (tensor<1x80x80x32xf32>, tensor<1x80x80x32xf32>) -> tensor<1x80x80x32xf32>
  %25 = "tfl.conv_2d"(%24, %cst_106, %cst_47) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x32xf32>, tensor<192x1x1x32xf32>, tensor<192xf32>) -> tensor<1x80x80x192xf32>
  %26 = "tfl.depthwise_conv_2d"(%25, %cst_182, %cst_48) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x192xf32>, tensor<1x3x3x192xf32>, tensor<192xf32>) -> tensor<1x80x80x192xf32>
  %27 = "tfl.conv_2d"(%26, %cst_107, %cst_183) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x192xf32>, tensor<32x1x1x192xf32>, tensor<32xf32>) -> tensor<1x80x80x32xf32>
  %28 = "tfl.add"(%24, %27) {fused_activation_function = "NONE"} : (tensor<1x80x80x32xf32>, tensor<1x80x80x32xf32>) -> tensor<1x80x80x32xf32>
  %29 = "tfl.conv_2d"(%28, %cst_108, %cst_184) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x32xf32>, tensor<128x1x1x32xf32>, tensor<128xf32>) -> tensor<1x80x80x128xf32>
  %30 = "tfl.conv_2d"(%28, %cst_109, %cst_49) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x32xf32>, tensor<192x1x1x32xf32>, tensor<192xf32>) -> tensor<1x80x80x192xf32>
  %31 = "tfl.depthwise_conv_2d"(%30, %cst_185, %cst_50) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 2 : i32, stride_w = 2 : i32} : (tensor<1x80x80x192xf32>, tensor<1x3x3x192xf32>, tensor<192xf32>) -> tensor<1x40x40x192xf32>
  %32 = "tfl.conv_2d"(%31, %cst_110, %cst_186) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x192xf32>, tensor<64x1x1x192xf32>, tensor<64xf32>) -> tensor<1x40x40x64xf32>
  %33 = "tfl.conv_2d"(%32, %cst_111, %cst_51) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x64xf32>, tensor<384x1x1x64xf32>, tensor<384xf32>) -> tensor<1x40x40x384xf32>
  %34 = "tfl.depthwise_conv_2d"(%33, %cst_187, %cst_52) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x384xf32>, tensor<1x3x3x384xf32>, tensor<384xf32>) -> tensor<1x40x40x384xf32>
  %35 = "tfl.conv_2d"(%34, %cst_112, %cst_188) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x384xf32>, tensor<64x1x1x384xf32>, tensor<64xf32>) -> tensor<1x40x40x64xf32>
  %36 = "tfl.add"(%32, %35) {fused_activation_function = "NONE"} : (tensor<1x40x40x64xf32>, tensor<1x40x40x64xf32>) -> tensor<1x40x40x64xf32>
  %37 = "tfl.conv_2d"(%36, %cst_113, %cst_53) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x64xf32>, tensor<384x1x1x64xf32>, tensor<384xf32>) -> tensor<1x40x40x384xf32>
  %38 = "tfl.depthwise_conv_2d"(%37, %cst_189, %cst_54) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x384xf32>, tensor<1x3x3x384xf32>, tensor<384xf32>) -> tensor<1x40x40x384xf32>
  %39 = "tfl.conv_2d"(%38, %cst_114, %cst_190) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x384xf32>, tensor<64x1x1x384xf32>, tensor<64xf32>) -> tensor<1x40x40x64xf32>
  %40 = "tfl.add"(%36, %39) {fused_activation_function = "NONE"} : (tensor<1x40x40x64xf32>, tensor<1x40x40x64xf32>) -> tensor<1x40x40x64xf32>
  %41 = "tfl.conv_2d"(%40, %cst_115, %cst_55) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x64xf32>, tensor<384x1x1x64xf32>, tensor<384xf32>) -> tensor<1x40x40x384xf32>
  %42 = "tfl.depthwise_conv_2d"(%41, %cst_191, %cst_56) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x384xf32>, tensor<1x3x3x384xf32>, tensor<384xf32>) -> tensor<1x40x40x384xf32>
  %43 = "tfl.conv_2d"(%42, %cst_116, %cst_192) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x384xf32>, tensor<64x1x1x384xf32>, tensor<64xf32>) -> tensor<1x40x40x64xf32>
  %44 = "tfl.add"(%40, %43) {fused_activation_function = "NONE"} : (tensor<1x40x40x64xf32>, tensor<1x40x40x64xf32>) -> tensor<1x40x40x64xf32>
  %45 = "tfl.conv_2d"(%44, %cst_117, %cst_57) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x64xf32>, tensor<384x1x1x64xf32>, tensor<384xf32>) -> tensor<1x40x40x384xf32>
  %46 = "tfl.depthwise_conv_2d"(%45, %cst_193, %cst_58) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x384xf32>, tensor<1x3x3x384xf32>, tensor<384xf32>) -> tensor<1x40x40x384xf32>
  %47 = "tfl.conv_2d"(%46, %cst_118, %cst_194) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x384xf32>, tensor<96x1x1x384xf32>, tensor<96xf32>) -> tensor<1x40x40x96xf32>
  %48 = "tfl.conv_2d"(%47, %cst_119, %cst_59) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x96xf32>, tensor<576x1x1x96xf32>, tensor<576xf32>) -> tensor<1x40x40x576xf32>
  %49 = "tfl.depthwise_conv_2d"(%48, %cst_195, %cst_60) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x576xf32>, tensor<1x3x3x576xf32>, tensor<576xf32>) -> tensor<1x40x40x576xf32>
  %50 = "tfl.conv_2d"(%49, %cst_120, %cst_196) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x576xf32>, tensor<96x1x1x576xf32>, tensor<96xf32>) -> tensor<1x40x40x96xf32>
  %51 = "tfl.add"(%47, %50) {fused_activation_function = "NONE"} : (tensor<1x40x40x96xf32>, tensor<1x40x40x96xf32>) -> tensor<1x40x40x96xf32>
  %52 = "tfl.conv_2d"(%51, %cst_121, %cst_61) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x96xf32>, tensor<576x1x1x96xf32>, tensor<576xf32>) -> tensor<1x40x40x576xf32>
  %53 = "tfl.depthwise_conv_2d"(%52, %cst_197, %cst_62) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x576xf32>, tensor<1x3x3x576xf32>, tensor<576xf32>) -> tensor<1x40x40x576xf32>
  %54 = "tfl.conv_2d"(%53, %cst_122, %cst_198) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x576xf32>, tensor<96x1x1x576xf32>, tensor<96xf32>) -> tensor<1x40x40x96xf32>
  %55 = "tfl.add"(%51, %54) {fused_activation_function = "NONE"} : (tensor<1x40x40x96xf32>, tensor<1x40x40x96xf32>) -> tensor<1x40x40x96xf32>
  %56 = "tfl.conv_2d"(%55, %cst_123, %cst_199) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x96xf32>, tensor<128x1x1x96xf32>, tensor<128xf32>) -> tensor<1x40x40x128xf32>
  %57 = "tfl.conv_2d"(%55, %cst_124, %cst_63) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x96xf32>, tensor<576x1x1x96xf32>, tensor<576xf32>) -> tensor<1x40x40x576xf32>
  %58 = "tfl.depthwise_conv_2d"(%57, %cst_200, %cst_64) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 2 : i32, stride_w = 2 : i32} : (tensor<1x40x40x576xf32>, tensor<1x3x3x576xf32>, tensor<576xf32>) -> tensor<1x20x20x576xf32>
  %59 = "tfl.conv_2d"(%58, %cst_125, %cst_201) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x576xf32>, tensor<160x1x1x576xf32>, tensor<160xf32>) -> tensor<1x20x20x160xf32>
  %60 = "tfl.conv_2d"(%59, %cst_126, %cst_65) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x160xf32>, tensor<960x1x1x160xf32>, tensor<960xf32>) -> tensor<1x20x20x960xf32>
  %61 = "tfl.depthwise_conv_2d"(%60, %cst_202, %cst_66) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x960xf32>, tensor<1x3x3x960xf32>, tensor<960xf32>) -> tensor<1x20x20x960xf32>
  %62 = "tfl.conv_2d"(%61, %cst_127, %cst_203) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x960xf32>, tensor<160x1x1x960xf32>, tensor<160xf32>) -> tensor<1x20x20x160xf32>
  %63 = "tfl.add"(%59, %62) {fused_activation_function = "NONE"} : (tensor<1x20x20x160xf32>, tensor<1x20x20x160xf32>) -> tensor<1x20x20x160xf32>
  %64 = "tfl.conv_2d"(%63, %cst_128, %cst_67) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x160xf32>, tensor<960x1x1x160xf32>, tensor<960xf32>) -> tensor<1x20x20x960xf32>
  %65 = "tfl.depthwise_conv_2d"(%64, %cst_204, %cst_68) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x960xf32>, tensor<1x3x3x960xf32>, tensor<960xf32>) -> tensor<1x20x20x960xf32>
  %66 = "tfl.conv_2d"(%65, %cst_129, %cst_205) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x960xf32>, tensor<160x1x1x960xf32>, tensor<160xf32>) -> tensor<1x20x20x160xf32>
  %67 = "tfl.add"(%63, %66) {fused_activation_function = "NONE"} : (tensor<1x20x20x160xf32>, tensor<1x20x20x160xf32>) -> tensor<1x20x20x160xf32>
  %68 = "tfl.conv_2d"(%67, %cst_130, %cst_69) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x160xf32>, tensor<960x1x1x160xf32>, tensor<960xf32>) -> tensor<1x20x20x960xf32>
  %69 = "tfl.depthwise_conv_2d"(%68, %cst_206, %cst_70) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x960xf32>, tensor<1x3x3x960xf32>, tensor<960xf32>) -> tensor<1x20x20x960xf32>
  %70 = "tfl.conv_2d"(%69, %cst_131, %cst_207) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x960xf32>, tensor<320x1x1x960xf32>, tensor<320xf32>) -> tensor<1x20x20x320xf32>
  %71 = "tfl.conv_2d"(%70, %cst_132, %cst_71) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x320xf32>, tensor<1280x1x1x320xf32>, tensor<1280xf32>) -> tensor<1x20x20x1280xf32>
  %72 = "tfl.conv_2d"(%71, %cst_133, %cst_208) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x1280xf32>, tensor<128x1x1x1280xf32>, tensor<128xf32>) -> tensor<1x20x20x128xf32>
  %73 = "tfl.pack"(%72, %72) {axis = 3 : i32, values_count = 2 : i32} : (tensor<1x20x20x128xf32>, tensor<1x20x20x128xf32>) -> tensor<1x20x20x2x128xf32>
  %74 = "tfl.pack"(%73, %73) {axis = 2 : i32, values_count = 2 : i32} : (tensor<1x20x20x2x128xf32>, tensor<1x20x20x2x128xf32>) -> tensor<1x20x2x20x2x128xf32>
  %75 = "tfl.reshape"(%74, %cst_28) : (tensor<1x20x2x20x2x128xf32>, tensor<4xi32>) -> tensor<1x40x40x128xf32>
  %76 = "tfl.add"(%75, %56) {fused_activation_function = "NONE"} : (tensor<1x40x40x128xf32>, tensor<1x40x40x128xf32>) -> tensor<1x40x40x128xf32>
  %77 = "tfl.depthwise_conv_2d"(%76, %cst_134, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x40x40x128xf32>
  %78 = "tfl.conv_2d"(%77, %cst_135, %cst_72) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x40x40x128xf32>
  %79 = "tfl.pack"(%78, %78) {axis = 3 : i32, values_count = 2 : i32} : (tensor<1x40x40x128xf32>, tensor<1x40x40x128xf32>) -> tensor<1x40x40x2x128xf32>
  %80 = "tfl.pack"(%79, %79) {axis = 2 : i32, values_count = 2 : i32} : (tensor<1x40x40x2x128xf32>, tensor<1x40x40x2x128xf32>) -> tensor<1x40x2x40x2x128xf32>
  %81 = "tfl.reshape"(%80, %cst_29) : (tensor<1x40x2x40x2x128xf32>, tensor<4xi32>) -> tensor<1x80x80x128xf32>
  %82 = "tfl.add"(%81, %29) {fused_activation_function = "NONE"} : (tensor<1x80x80x128xf32>, tensor<1x80x80x128xf32>) -> tensor<1x80x80x128xf32>
  %83 = "tfl.depthwise_conv_2d"(%82, %cst_136, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x80x80x128xf32>
  %84 = "tfl.conv_2d"(%83, %cst_137, %cst_73) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x80x80x128xf32>
  %85 = "tfl.depthwise_conv_2d"(%72, %cst_138, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 2 : i32, stride_w = 2 : i32} : (tensor<1x20x20x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x10x10x128xf32>
  %86 = "tfl.conv_2d"(%85, %cst_139, %cst_74) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x10x10x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x10x10x128xf32>
  %87 = "tfl.depthwise_conv_2d"(%86, %cst_140, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 2 : i32, stride_w = 2 : i32} : (tensor<1x10x10x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x5x5x128xf32>
  %88 = "tfl.conv_2d"(%87, %cst_141, %cst_75) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x5x5x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x5x5x128xf32>
  %89 = "tfl.depthwise_conv_2d"(%84, %cst_146, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x80x80x128xf32>
  %90 = "tfl.conv_2d"(%89, %cst_142, %cst_76) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x80x80x128xf32>
  %91 = "tfl.depthwise_conv_2d"(%78, %cst_146, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x40x40x128xf32>
  %92 = "tfl.conv_2d"(%91, %cst_143, %cst_77) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x40x40x128xf32>
  %93 = "tfl.depthwise_conv_2d"(%72, %cst_146, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x20x20x128xf32>
  %94 = "tfl.conv_2d"(%93, %cst_144, %cst_78) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x20x20x128xf32>
  %95 = "tfl.depthwise_conv_2d"(%86, %cst_146, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x10x10x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x10x10x128xf32>
  %96 = "tfl.conv_2d"(%95, %cst_145, %cst_79) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x10x10x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x10x10x128xf32>
  %97 = "tfl.depthwise_conv_2d"(%88, %cst_146, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x5x5x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x5x5x128xf32>
  %98 = "tfl.conv_2d"(%97, %cst_147, %cst_80) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x5x5x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x5x5x128xf32>
  %99 = "tfl.depthwise_conv_2d"(%90, %cst_152, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x80x80x128xf32>
  %100 = "tfl.conv_2d"(%99, %cst_148, %cst_81) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x80x80x128xf32>
  %101 = "tfl.depthwise_conv_2d"(%92, %cst_152, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x40x40x128xf32>
  %102 = "tfl.conv_2d"(%101, %cst_149, %cst_82) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x40x40x128xf32>
  %103 = "tfl.depthwise_conv_2d"(%94, %cst_152, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x20x20x128xf32>
  %104 = "tfl.conv_2d"(%103, %cst_150, %cst_83) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x20x20x128xf32>
  %105 = "tfl.depthwise_conv_2d"(%96, %cst_152, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x10x10x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x10x10x128xf32>
  %106 = "tfl.conv_2d"(%105, %cst_151, %cst_84) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x10x10x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x10x10x128xf32>
  %107 = "tfl.depthwise_conv_2d"(%98, %cst_152, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x5x5x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x5x5x128xf32>
  %108 = "tfl.conv_2d"(%107, %cst_153, %cst_85) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x5x5x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x5x5x128xf32>
  %109 = "tfl.depthwise_conv_2d"(%100, %cst_158, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x80x80x128xf32>
  %110 = "tfl.conv_2d"(%109, %cst_154, %cst_86) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x80x80x128xf32>
  %111 = "tfl.depthwise_conv_2d"(%102, %cst_158, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x40x40x128xf32>
  %112 = "tfl.conv_2d"(%111, %cst_155, %cst_87) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x40x40x128xf32>
  %113 = "tfl.depthwise_conv_2d"(%104, %cst_158, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x20x20x128xf32>
  %114 = "tfl.conv_2d"(%113, %cst_156, %cst_88) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x20x20x128xf32>
  %115 = "tfl.depthwise_conv_2d"(%106, %cst_158, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x10x10x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x10x10x128xf32>
  %116 = "tfl.conv_2d"(%115, %cst_157, %cst_89) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x10x10x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x10x10x128xf32>
  %117 = "tfl.depthwise_conv_2d"(%108, %cst_158, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x5x5x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x5x5x128xf32>
  %118 = "tfl.conv_2d"(%117, %cst_159, %cst_90) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x5x5x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x5x5x128xf32>
  %119 = "tfl.depthwise_conv_2d"(%110, %cst_164, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x80x80x128xf32>
  %120 = "tfl.conv_2d"(%119, %cst_160, %cst_91) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x80x80x128xf32>
  %121 = "tfl.depthwise_conv_2d"(%112, %cst_164, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x40x40x128xf32>
  %122 = "tfl.conv_2d"(%121, %cst_161, %cst_92) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x40x40x128xf32>
  %123 = "tfl.depthwise_conv_2d"(%114, %cst_164, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x20x20x128xf32>
  %124 = "tfl.conv_2d"(%123, %cst_162, %cst_93) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x20x20x128xf32>
  %125 = "tfl.depthwise_conv_2d"(%116, %cst_164, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x10x10x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x10x10x128xf32>
  %126 = "tfl.conv_2d"(%125, %cst_163, %cst_94) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x10x10x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x10x10x128xf32>
  %127 = "tfl.depthwise_conv_2d"(%118, %cst_164, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x5x5x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x5x5x128xf32>
  %128 = "tfl.conv_2d"(%127, %cst_165, %cst_95) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "RELU6", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x5x5x128xf32>, tensor<128x1x1x128xf32>, tensor<128xf32>) -> tensor<1x5x5x128xf32>
  %129 = "tfl.depthwise_conv_2d"(%120, %cst_166, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x80x80x128xf32>
  %130 = "tfl.conv_2d"(%129, %cst_167, %cst_209) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x128xf32>, tensor<24x1x1x128xf32>, tensor<24xf32>) -> tensor<1x80x80x24xf32>
  %131 = "tfl.reshape"(%130, %cst_24) : (tensor<1x80x80x24xf32>, tensor<3xi32>) -> tensor<1x38400x4xf32>
  %132 = "tfl.depthwise_conv_2d"(%122, %cst_166, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x40x40x128xf32>
  %133 = "tfl.conv_2d"(%132, %cst_167, %cst_209) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x128xf32>, tensor<24x1x1x128xf32>, tensor<24xf32>) -> tensor<1x40x40x24xf32>
  %134 = "tfl.reshape"(%133, %cst_24) : (tensor<1x40x40x24xf32>, tensor<3xi32>) -> tensor<1x9600x4xf32>
  %135 = "tfl.depthwise_conv_2d"(%124, %cst_166, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x20x20x128xf32>
  %136 = "tfl.conv_2d"(%135, %cst_167, %cst_209) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x128xf32>, tensor<24x1x1x128xf32>, tensor<24xf32>) -> tensor<1x20x20x24xf32>
  %137 = "tfl.reshape"(%136, %cst_24) : (tensor<1x20x20x24xf32>, tensor<3xi32>) -> tensor<1x2400x4xf32>
  %138 = "tfl.depthwise_conv_2d"(%126, %cst_166, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x10x10x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x10x10x128xf32>
  %139 = "tfl.conv_2d"(%138, %cst_167, %cst_209) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x10x10x128xf32>, tensor<24x1x1x128xf32>, tensor<24xf32>) -> tensor<1x10x10x24xf32>
  %140 = "tfl.reshape"(%139, %cst_24) : (tensor<1x10x10x24xf32>, tensor<3xi32>) -> tensor<1x600x4xf32>
  %141 = "tfl.depthwise_conv_2d"(%128, %cst_166, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x5x5x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x5x5x128xf32>
  %142 = "tfl.conv_2d"(%141, %cst_167, %cst_209) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x5x5x128xf32>, tensor<24x1x1x128xf32>, tensor<24xf32>) -> tensor<1x5x5x24xf32>
  %143 = "tfl.reshape"(%142, %cst_24) : (tensor<1x5x5x24xf32>, tensor<3xi32>) -> tensor<1x150x4xf32>
  %144 = "tfl.concatenation"(%131, %134, %137, %140, %143) {axis = 1 : i32, fused_activation_function = "NONE"} : (tensor<1x38400x4xf32>, tensor<1x9600x4xf32>, tensor<1x2400x4xf32>, tensor<1x600x4xf32>, tensor<1x150x4xf32>) -> tensor<1x51150x4xf32>
  %145 = "tfl.reshape"(%144, %cst_17) : (tensor<1x51150x4xf32>, tensor<2xi32>) -> tensor<51150x4xf32>
  %146 = "tfl.transpose"(%145, %cst_15) : (tensor<51150x4xf32>, tensor<2xi32>) -> tensor<4x51150xf32>
  %147:4 = "tfl.unpack"(%146) {axis = 0 : i32, num = 4 : i32} : (tensor<4x51150xf32>) -> (tensor<51150xf32>, tensor<51150xf32>, tensor<51150xf32>, tensor<51150xf32>)
  %148 = "tfl.mul"(%147#0, %cst_30) {fused_activation_function = "NONE"} : (tensor<51150xf32>, tensor<f32>) -> tensor<51150xf32>
  %149 = "tfl.mul"(%148, %cst_33) {fused_activation_function = "NONE"} : (tensor<51150xf32>, tensor<51150xf32>) -> tensor<51150xf32>
  %150 = "tfl.add"(%149, %cst_34) {fused_activation_function = "NONE"} : (tensor<51150xf32>, tensor<51150xf32>) -> tensor<51150xf32>
  %151 = "tfl.mul"(%147#1, %cst_30) {fused_activation_function = "NONE"} : (tensor<51150xf32>, tensor<f32>) -> tensor<51150xf32>
  %152 = "tfl.mul"(%151, %cst_35) {fused_activation_function = "NONE"} : (tensor<51150xf32>, tensor<51150xf32>) -> tensor<51150xf32>
  %153 = "tfl.add"(%152, %cst_36) {fused_activation_function = "NONE"} : (tensor<51150xf32>, tensor<51150xf32>) -> tensor<51150xf32>
  %154 = "tfl.mul"(%147#2, %cst_31) {fused_activation_function = "NONE"} : (tensor<51150xf32>, tensor<f32>) -> tensor<51150xf32>
  %155 = "tfl.exp"(%154) : (tensor<51150xf32>) -> tensor<51150xf32>
  %156 = "tfl.mul"(%155, %cst_33) {fused_activation_function = "NONE"} : (tensor<51150xf32>, tensor<51150xf32>) -> tensor<51150xf32>
  %157 = "tfl.mul"(%156, %cst_32) {fused_activation_function = "NONE"} : (tensor<51150xf32>, tensor<f32>) -> tensor<51150xf32>
  %158 = "tfl.sub"(%150, %157) {fused_activation_function = "NONE"} : (tensor<51150xf32>, tensor<51150xf32>) -> tensor<51150xf32>
  %159 = "tfl.add"(%150, %157) {fused_activation_function = "NONE"} : (tensor<51150xf32>, tensor<51150xf32>) -> tensor<51150xf32>
  %160 = "tfl.mul"(%147#3, %cst_31) {fused_activation_function = "NONE"} : (tensor<51150xf32>, tensor<f32>) -> tensor<51150xf32>
  %161 = "tfl.exp"(%160) : (tensor<51150xf32>) -> tensor<51150xf32>
  %162 = "tfl.mul"(%161, %cst_35) {fused_activation_function = "NONE"} : (tensor<51150xf32>, tensor<51150xf32>) -> tensor<51150xf32>
  %163 = "tfl.mul"(%162, %cst_32) {fused_activation_function = "NONE"} : (tensor<51150xf32>, tensor<f32>) -> tensor<51150xf32>
  %164 = "tfl.sub"(%153, %163) {fused_activation_function = "NONE"} : (tensor<51150xf32>, tensor<51150xf32>) -> tensor<51150xf32>
  %165 = "tfl.add"(%153, %163) {fused_activation_function = "NONE"} : (tensor<51150xf32>, tensor<51150xf32>) -> tensor<51150xf32>
  %166 = "tfl.pack"(%158, %164, %159, %165) {axis = 0 : i32, values_count = 4 : i32} : (tensor<51150xf32>, tensor<51150xf32>, tensor<51150xf32>, tensor<51150xf32>) -> tensor<4x51150xf32>
  %167 = "tfl.transpose"(%166, %cst_15) : (tensor<4x51150xf32>, tensor<2xi32>) -> tensor<51150x4xf32>
  %168 = "tfl.reshape"(%167, %cst_211) : (tensor<51150x4xf32>, tensor<3xi32>) -> tensor<1x51150x4xf32>
  %169 = "tfl.reshape"(%167, %cst_210) : (tensor<51150x4xf32>, tensor<4xi32>) -> tensor<1x51150x1x4xf32>
  %170 = "tfl.unpack"(%169) {axis = 0 : i32, num = 1 : i32} : (tensor<1x51150x1x4xf32>) -> tensor<51150x1x4xf32>
  %171 = "tfl.slice"(%170, %cst_8, %cst_10) : (tensor<51150x1x4xf32>, tensor<3xi32>, tensor<3xi32>) -> tensor<51150x1x4xf32>
  %172 = "tfl.unpack"(%171) {axis = 1 : i32, num = 1 : i32} : (tensor<51150x1x4xf32>) -> tensor<51150x4xf32>
  %173 = "tfl.depthwise_conv_2d"(%120, %cst_169, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x80x80x128xf32>
  %174 = "tfl.conv_2d"(%173, %cst_170, %cst_212) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x80x80x128xf32>, tensor<12x1x1x128xf32>, tensor<12xf32>) -> tensor<1x80x80x12xf32>
  %175 = "tfl.reshape"(%174, %cst_25) : (tensor<1x80x80x12xf32>, tensor<3xi32>) -> tensor<1x38400x2xf32>
  %176 = "tfl.depthwise_conv_2d"(%122, %cst_169, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x40x40x128xf32>
  %177 = "tfl.conv_2d"(%176, %cst_170, %cst_212) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x40x40x128xf32>, tensor<12x1x1x128xf32>, tensor<12xf32>) -> tensor<1x40x40x12xf32>
  %178 = "tfl.reshape"(%177, %cst_25) : (tensor<1x40x40x12xf32>, tensor<3xi32>) -> tensor<1x9600x2xf32>
  %179 = "tfl.depthwise_conv_2d"(%124, %cst_169, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x20x20x128xf32>
  %180 = "tfl.conv_2d"(%179, %cst_170, %cst_212) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x20x20x128xf32>, tensor<12x1x1x128xf32>, tensor<12xf32>) -> tensor<1x20x20x12xf32>
  %181 = "tfl.reshape"(%180, %cst_25) : (tensor<1x20x20x12xf32>, tensor<3xi32>) -> tensor<1x2400x2xf32>
  %182 = "tfl.depthwise_conv_2d"(%126, %cst_169, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x10x10x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x10x10x128xf32>
  %183 = "tfl.conv_2d"(%182, %cst_170, %cst_212) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x10x10x128xf32>, tensor<12x1x1x128xf32>, tensor<12xf32>) -> tensor<1x10x10x12xf32>
  %184 = "tfl.reshape"(%183, %cst_25) : (tensor<1x10x10x12xf32>, tensor<3xi32>) -> tensor<1x600x2xf32>
  %185 = "tfl.depthwise_conv_2d"(%128, %cst_169, %cst_168) {depth_multiplier = 1 : i32, dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "SAME", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x5x5x128xf32>, tensor<1x3x3x128xf32>, tensor<128xf32>) -> tensor<1x5x5x128xf32>
  %186 = "tfl.conv_2d"(%185, %cst_170, %cst_212) {dilation_h_factor = 1 : i32, dilation_w_factor = 1 : i32, fused_activation_function = "NONE", padding = "VALID", stride_h = 1 : i32, stride_w = 1 : i32} : (tensor<1x5x5x128xf32>, tensor<12x1x1x128xf32>, tensor<12xf32>) -> tensor<1x5x5x12xf32>
  %187 = "tfl.reshape"(%186, %cst_25) : (tensor<1x5x5x12xf32>, tensor<3xi32>) -> tensor<1x150x2xf32>
  %188 = "tfl.concatenation"(%175, %178, %181, %184, %187) {axis = 1 : i32, fused_activation_function = "NONE"} : (tensor<1x38400x2xf32>, tensor<1x9600x2xf32>, tensor<1x2400x2xf32>, tensor<1x600x2xf32>, tensor<1x150x2xf32>) -> tensor<1x51150x2xf32>
  %189 = "tfl.logistic"(%188) : (tensor<1x51150x2xf32>) -> tensor<1x51150x2xf32>
  %190 = "tfl.unpack"(%189) {axis = 0 : i32, num = 1 : i32} : (tensor<1x51150x2xf32>) -> tensor<51150x2xf32>
  %191 = "tfl.slice"(%190, %cst_9, %cst_11) : (tensor<51150x2xf32>, tensor<2xi32>, tensor<2xi32>) -> tensor<51150x2xf32>
  %192 = "tfl.slice"(%189, %cst_18, %cst_19) : (tensor<1x51150x2xf32>, tensor<3xi32>, tensor<3xi32>) -> tensor<1x51150x1xf32>
  %193 = "tfl.unpack"(%192) {axis = 0 : i32, num = 1 : i32} : (tensor<1x51150x1xf32>) -> tensor<51150x1xf32>
  %194 = "tfl.slice"(%193, %cst_9, %cst_11) : (tensor<51150x1xf32>, tensor<2xi32>, tensor<2xi32>) -> tensor<51150x1xf32>
  %195 = "tfl.slice"(%194, %cst_9, %cst_2) : (tensor<51150x1xf32>, tensor<2xi32>, tensor<2xi32>) -> tensor<51150x1xf32>
  %196 = "tfl.reshape"(%195, %cst_213) : (tensor<51150x1xf32>, tensor<1xi32>) -> tensor<51150xf32>
  %selected_indices, %selected_scores, %valid_outputs = "tfl.non_max_suppression_v5"(%172, %196, %cst_7, %cst_0, %cst_1, %cst_14) : (tensor<51150x4xf32>, tensor<51150xf32>, tensor<i32>, tensor<f32>, tensor<f32>, tensor<f32>) -> (tensor<?xi32>, tensor<?xf32>, tensor<i32>)
  %197 = "tfl.shape"(%selected_indices) : (tensor<?xi32>) -> tensor<1xi32>
  %198 = "tfl.strided_slice"(%197, %cst_214, %cst_216, %cst_216) {begin_mask = 0 : i32, ellipsis_mask = 0 : i32, end_mask = 0 : i32, new_axis_mask = 0 : i32, shrink_axis_mask = 1 : i32} : (tensor<1xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<i32>
  %199 = "tfl.less"(%cst_3, %198) : (tensor<100xi32>, tensor<i32>) -> tensor<100xi1>
  %200 = "tfl.sub"(%cst_7, %198) {fused_activation_function = "NONE"} : (tensor<i32>, tensor<i32>) -> tensor<i32>
  %201 = "tfl.reshape"(%200, %cst_213) : (tensor<i32>, tensor<1xi32>) -> tensor<1xi32>
  %202 = "tfl.fill"(%201, %cst_21) : (tensor<1xi32>, tensor<i32>) -> tensor<?xi32>
  %203 = "tfl.fill"(%201, %cst_14) : (tensor<1xi32>, tensor<f32>) -> tensor<?xf32>
  %204 = "tfl.concatenation"(%selected_indices, %202) {axis = 0 : i32, fused_activation_function = "NONE"} : (tensor<?xi32>, tensor<?xi32>) -> tensor<?xi32>
  %205 = "tfl.gather"(%cst_20, %204) {axis = 0 : i32} : (tensor<51150xf32>, tensor<?xi32>) -> tensor<?xf32>
  %206 = "tfl.gather"(%191, %204) {axis = 0 : i32} : (tensor<51150x2xf32>, tensor<?xi32>) -> tensor<?x2xf32>
  %207 = "tfl.gather"(%172, %204) {axis = 0 : i32} : (tensor<51150x4xf32>, tensor<?xi32>) -> tensor<?x4xf32>
  %208 = "tfl.shape"(%207) : (tensor<?x4xf32>) -> tensor<2xi32>
  %209 = "tfl.strided_slice"(%208, %cst_214, %cst_216, %cst_216) {begin_mask = 0 : i32, ellipsis_mask = 0 : i32, end_mask = 0 : i32, new_axis_mask = 0 : i32, shrink_axis_mask = 1 : i32} : (tensor<2xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<i32>
  %210 = "tfl.equal"(%209, %cst_7) : (tensor<i32>, tensor<i32>) -> tensor<i1>
  %211 = "tfl.concatenation"(%selected_scores, %203) {axis = -1 : i32, fused_activation_function = "NONE"} : (tensor<?xf32>, tensor<?xf32>) -> tensor<?xf32>
  %212 = "tfl.select"(%199, %211, %cst_4) : (tensor<100xi1>, tensor<?xf32>, tensor<100xf32>) -> tensor<100xf32>
  %values, %indices = "tfl.topk_v2"(%212, %209) : (tensor<100xf32>, tensor<i32>) -> (tensor<?xf32>, tensor<?xi32>)
  %213 = "tfl.gather"(%212, %indices) {axis = 0 : i32} : (tensor<100xf32>, tensor<?xi32>) -> tensor<?xf32>
  %214 = "tfl.gather"(%205, %indices) {axis = 0 : i32} : (tensor<?xf32>, tensor<?xi32>) -> tensor<?xf32>
  %215 = "tfl.gather"(%206, %indices) {axis = 0 : i32} : (tensor<?x2xf32>, tensor<?xi32>) -> tensor<?x2xf32>
  %216 = "tfl.gather"(%cst_5, %indices) {axis = 0 : i32} : (tensor<100xf32>, tensor<?xi32>) -> tensor<?xf32>
  %217 = "tfl.gather"(%207, %indices) {axis = 0 : i32} : (tensor<?x4xf32>, tensor<?xi32>) -> tensor<?x4xf32>
  %218:4 = "tfl.split"(%cst_27, %217) {num_splits = 4 : i32} : (tensor<i32>, tensor<?x4xf32>) -> (tensor<?x1xf32>, tensor<?x1xf32>, tensor<?x1xf32>, tensor<?x1xf32>)
  %219 = "tfl.minimum"(%218#0, %cst_26) : (tensor<?x1xf32>, tensor<f32>) -> tensor<?x1xf32>
  %220 = "tfl.relu"(%219) : (tensor<?x1xf32>) -> tensor<?x1xf32>
  %221 = "tfl.minimum"(%218#2, %cst_26) : (tensor<?x1xf32>, tensor<f32>) -> tensor<?x1xf32>
  %222 = "tfl.relu"(%221) : (tensor<?x1xf32>) -> tensor<?x1xf32>
  %223 = "tfl.minimum"(%218#1, %cst_26) : (tensor<?x1xf32>, tensor<f32>) -> tensor<?x1xf32>
  %224 = "tfl.relu"(%223) : (tensor<?x1xf32>) -> tensor<?x1xf32>
  %225 = "tfl.minimum"(%218#3, %cst_26) : (tensor<?x1xf32>, tensor<f32>) -> tensor<?x1xf32>
  %226 = "tfl.relu"(%225) : (tensor<?x1xf32>) -> tensor<?x1xf32>
  %227 = "tfl.concatenation"(%220, %224, %222, %226) {axis = 1 : i32, fused_activation_function = "NONE"} : (tensor<?x1xf32>, tensor<?x1xf32>, tensor<?x1xf32>, tensor<?x1xf32>) -> tensor<?x4xf32>
  %228:4 = "tfl.split"(%cst_27, %227) {num_splits = 4 : i32} : (tensor<i32>, tensor<?x4xf32>) -> (tensor<?x1xf32>, tensor<?x1xf32>, tensor<?x1xf32>, tensor<?x1xf32>)
  %229 = "tfl.sub"(%228#2, %228#0) {fused_activation_function = "NONE"} : (tensor<?x1xf32>, tensor<?x1xf32>) -> tensor<?x1xf32>
  %230 = "tfl.sub"(%228#3, %228#1) {fused_activation_function = "NONE"} : (tensor<?x1xf32>, tensor<?x1xf32>) -> tensor<?x1xf32>
  %231 = "tfl.mul"(%229, %230) {fused_activation_function = "NONE"} : (tensor<?x1xf32>, tensor<?x1xf32>) -> tensor<?x1xf32>
  %232 = "tfl.greater"(%231, %cst_14) : (tensor<?x1xf32>, tensor<f32>) -> tensor<?x1xi1>
  %233 = "tfl.reshape"(%232, %cst_213) : (tensor<?x1xi1>, tensor<1xi32>) -> tensor<?xi1>
  %234 = "tfl.where"(%233) : (tensor<?xi1>) -> tensor<?x1xi64>
  %235 = "tfl.reshape"(%234, %cst_213) : (tensor<?x1xi64>, tensor<1xi32>) -> tensor<?xi64>
  %236 = "tfl.cast"(%235) : (tensor<?xi64>) -> tensor<?xi32>
  %237 = "tfl.gather"(%213, %236) {axis = 0 : i32} : (tensor<?xf32>, tensor<?xi32>) -> tensor<?xf32>
  %238 = "tfl.gather"(%214, %236) {axis = 0 : i32} : (tensor<?xf32>, tensor<?xi32>) -> tensor<?xf32>
  %239 = "tfl.gather"(%215, %236) {axis = 0 : i32} : (tensor<?x2xf32>, tensor<?xi32>) -> tensor<?x2xf32>
  %240 = "tfl.gather"(%216, %236) {axis = 0 : i32} : (tensor<?xf32>, tensor<?xi32>) -> tensor<?xf32>
  %241 = "tfl.gather"(%227, %236) {axis = 0 : i32} : (tensor<?x4xf32>, tensor<?xi32>) -> tensor<?x4xf32>
  %242:4 = "tfl.split"(%cst_27, %241) {num_splits = 4 : i32} : (tensor<i32>, tensor<?x4xf32>) -> (tensor<?x1xf32>, tensor<?x1xf32>, tensor<?x1xf32>, tensor<?x1xf32>)
  %243 = "tfl.sub"(%242#2, %242#0) {fused_activation_function = "NONE"} : (tensor<?x1xf32>, tensor<?x1xf32>) -> tensor<?x1xf32>
  %244 = "tfl.sub"(%242#3, %242#1) {fused_activation_function = "NONE"} : (tensor<?x1xf32>, tensor<?x1xf32>) -> tensor<?x1xf32>
  %245 = "tfl.mul"(%243, %244) {fused_activation_function = "NONE"} : (tensor<?x1xf32>, tensor<?x1xf32>) -> tensor<?x1xf32>
  %246 = "tfl.reshape"(%245, %cst_213) : (tensor<?x1xf32>, tensor<1xi32>) -> tensor<?xf32>
  %247 = "tfl.cast"(%246) : (tensor<?xf32>) -> tensor<?xi1>
  %248 = "tfl.shape"(%241) : (tensor<?x4xf32>) -> tensor<2xi32>
  %249 = "tfl.strided_slice"(%248, %cst_214, %cst_216, %cst_216) {begin_mask = 0 : i32, ellipsis_mask = 0 : i32, end_mask = 0 : i32, new_axis_mask = 0 : i32, shrink_axis_mask = 1 : i32} : (tensor<2xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<i32>
  %250 = "tfl.reshape"(%249, %cst_213) : (tensor<i32>, tensor<1xi32>) -> tensor<1xi32>
  %251 = "tfl.fill"(%250, %cst_26) : (tensor<1xi32>, tensor<f32>) -> tensor<?xf32>
  %252 = "tfl.mul"(%251, %cst) {fused_activation_function = "NONE"} : (tensor<?xf32>, tensor<f32>) -> tensor<?xf32>
  %253 = "tfl.select"(%247, %237, %252) : (tensor<?xi1>, tensor<?xf32>, tensor<?xf32>) -> tensor<?xf32>
  %254 = "tfl.greater_equal"(%253, %cst_14) : (tensor<?xf32>, tensor<f32>) -> tensor<?xi1>
  %255 = "tfl.cast"(%254) : (tensor<?xi1>) -> tensor<?xi32>
  %256 = "tfl.sum"(%255, %cst_214) {keep_dims = false} : (tensor<?xi32>, tensor<1xi32>) -> tensor<i32>
  %257 = "tf.Size"(%253) {device = ""} : (tensor<?xf32>) -> tensor<i32>
  %258 = "tfl.equal"(%249, %257) : (tensor<i32>, tensor<i32>) -> tensor<i1>
  %values_217, %indices_218 = "tfl.topk_v2"(%253, %249) : (tensor<?xf32>, tensor<i32>) -> (tensor<?xf32>, tensor<?xi32>)
  %259 = "tfl.gather"(%253, %indices_218) {axis = 0 : i32} : (tensor<?xf32>, tensor<?xi32>) -> tensor<?xf32>
  %260 = "tfl.gather"(%238, %indices_218) {axis = 0 : i32} : (tensor<?xf32>, tensor<?xi32>) -> tensor<?xf32>
  %261 = "tfl.gather"(%239, %indices_218) {axis = 0 : i32} : (tensor<?x2xf32>, tensor<?xi32>) -> tensor<?x2xf32>
  %262 = "tfl.gather"(%240, %indices_218) {axis = 0 : i32} : (tensor<?xf32>, tensor<?xi32>) -> tensor<?xf32>
  %263 = "tfl.gather"(%241, %indices_218) {axis = 0 : i32} : (tensor<?x4xf32>, tensor<?xi32>) -> tensor<?x4xf32>
  %264 = "tfl.sub"(%263, %cst_13) {fused_activation_function = "NONE"} : (tensor<?x4xf32>, tensor<4xf32>) -> tensor<?x4xf32>
  %265:4 = "tfl.split"(%cst_27, %264) {num_splits = 4 : i32} : (tensor<i32>, tensor<?x4xf32>) -> (tensor<?x1xf32>, tensor<?x1xf32>, tensor<?x1xf32>, tensor<?x1xf32>)
  %266 = "tfl.concatenation"(%265#0, %265#1, %265#2, %265#3) {axis = 1 : i32, fused_activation_function = "NONE"} : (tensor<?x1xf32>, tensor<?x1xf32>, tensor<?x1xf32>, tensor<?x1xf32>) -> tensor<?x4xf32>
  %267 = "tfl.shape"(%266) : (tensor<?x4xf32>) -> tensor<2xi32>
  %268 = "tfl.strided_slice"(%267, %cst_214, %cst_216, %cst_216) {begin_mask = 0 : i32, ellipsis_mask = 0 : i32, end_mask = 0 : i32, new_axis_mask = 0 : i32, shrink_axis_mask = 1 : i32} : (tensor<2xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<i32>
  %269 = "tfl.minimum"(%268, %cst_7) : (tensor<i32>, tensor<i32>) -> tensor<i32>
  %270 = "tfl.greater"(%269, %256) : (tensor<i32>, tensor<i32>) -> tensor<i1>
  %271 = "tfl.select"(%270, %256, %269) : (tensor<i1>, tensor<i32>, tensor<i32>) -> tensor<i32>
  %272 = "tfl.range"(%cst_21, %271, %cst_27) : (tensor<i32>, tensor<i32>, tensor<i32>) -> tensor<?xi32>
  %273 = "tfl.pack"(%271) {axis = 0 : i32, values_count = 1 : i32} : (tensor<i32>) -> tensor<1xi32>
  %274 = "tfl.cast"(%273) : (tensor<1xi32>) -> tensor<1xf32>
  %275 = "tfl.range"(%cst_21, %269, %cst_27) : (tensor<i32>, tensor<i32>, tensor<i32>) -> tensor<?xi32>
  %276 = "tfl.gather"(%259, %275) {axis = 0 : i32} : (tensor<?xf32>, tensor<?xi32>) -> tensor<?xf32>
  %277 = "tfl.gather"(%276, %272) {axis = 0 : i32} : (tensor<?xf32>, tensor<?xi32>) -> tensor<?xf32>
  %278 = "tfl.shape"(%277) : (tensor<?xf32>) -> tensor<1xi32>
  %279 = "tfl.strided_slice"(%278, %cst_214, %cst_216, %cst_216) {begin_mask = 0 : i32, ellipsis_mask = 0 : i32, end_mask = 0 : i32, new_axis_mask = 0 : i32, shrink_axis_mask = 1 : i32} : (tensor<1xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<i32>
  %280 = "tfl.sub"(%279, %cst_7) {fused_activation_function = "NONE"} : (tensor<i32>, tensor<i32>) -> tensor<i32>
  %281 = "tfl.greater"(%280, %cst_21) : (tensor<i32>, tensor<i32>) -> tensor<i1>
  %282 = "tfl.select"(%281, %cst_7, %cst_12) : (tensor<i1>, tensor<i32>, tensor<i32>) -> tensor<i32>
  %283 = "tfl.pack"(%282) {axis = 0 : i32, values_count = 1 : i32} : (tensor<i32>) -> tensor<1xi32>
  %284 = "tfl.slice"(%277, %cst_214, %283) : (tensor<?xf32>, tensor<1xi32>, tensor<1xi32>) -> tensor<?xf32>
  %285 = "tfl.shape"(%284) : (tensor<?xf32>) -> tensor<1xi32>
  %286 = "tfl.strided_slice"(%285, %cst_214, %cst_216, %cst_216) {begin_mask = 0 : i32, ellipsis_mask = 0 : i32, end_mask = 0 : i32, new_axis_mask = 0 : i32, shrink_axis_mask = 1 : i32} : (tensor<1xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<i32>
  %287 = "tfl.sub"(%cst_7, %286) {fused_activation_function = "NONE"} : (tensor<i32>, tensor<i32>) -> tensor<i32>
  %288 = "tfl.pack"(%287) {axis = 0 : i32, values_count = 1 : i32} : (tensor<i32>) -> tensor<1xi32>
  %289 = "tfl.pack"(%cst_214, %288) {axis = 1 : i32, values_count = 2 : i32} : (tensor<1xi32>, tensor<1xi32>) -> tensor<1x2xi32>
  %290 = "tfl.pad"(%284, %289) : (tensor<?xf32>, tensor<1x2xi32>) -> tensor<?xf32>
  %291 = "tfl.pack"(%290) {axis = 0 : i32, values_count = 1 : i32} : (tensor<?xf32>) -> tensor<1x?xf32>
  %292 = "tfl.gather"(%260, %275) {axis = 0 : i32} : (tensor<?xf32>, tensor<?xi32>) -> tensor<?xf32>
  %293 = "tfl.gather"(%292, %272) {axis = 0 : i32} : (tensor<?xf32>, tensor<?xi32>) -> tensor<?xf32>
  %294 = "tfl.shape"(%293) : (tensor<?xf32>) -> tensor<1xi32>
  %295 = "tfl.strided_slice"(%294, %cst_214, %cst_216, %cst_216) {begin_mask = 0 : i32, ellipsis_mask = 0 : i32, end_mask = 0 : i32, new_axis_mask = 0 : i32, shrink_axis_mask = 1 : i32} : (tensor<1xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<i32>
  %296 = "tfl.sub"(%295, %cst_7) {fused_activation_function = "NONE"} : (tensor<i32>, tensor<i32>) -> tensor<i32>
  %297 = "tfl.greater"(%296, %cst_21) : (tensor<i32>, tensor<i32>) -> tensor<i1>
  %298 = "tfl.select"(%297, %cst_7, %cst_12) : (tensor<i1>, tensor<i32>, tensor<i32>) -> tensor<i32>
  %299 = "tfl.pack"(%298) {axis = 0 : i32, values_count = 1 : i32} : (tensor<i32>) -> tensor<1xi32>
  %300 = "tfl.slice"(%293, %cst_214, %299) : (tensor<?xf32>, tensor<1xi32>, tensor<1xi32>) -> tensor<?xf32>
  %301 = "tfl.shape"(%300) : (tensor<?xf32>) -> tensor<1xi32>
  %302 = "tfl.strided_slice"(%301, %cst_214, %cst_216, %cst_216) {begin_mask = 0 : i32, ellipsis_mask = 0 : i32, end_mask = 0 : i32, new_axis_mask = 0 : i32, shrink_axis_mask = 1 : i32} : (tensor<1xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<i32>
  %303 = "tfl.sub"(%cst_7, %302) {fused_activation_function = "NONE"} : (tensor<i32>, tensor<i32>) -> tensor<i32>
  %304 = "tfl.pack"(%303) {axis = 0 : i32, values_count = 1 : i32} : (tensor<i32>) -> tensor<1xi32>
  %305 = "tfl.pack"(%cst_214, %304) {axis = 1 : i32, values_count = 2 : i32} : (tensor<1xi32>, tensor<1xi32>) -> tensor<1x2xi32>
  %306 = "tfl.pad"(%300, %305) : (tensor<?xf32>, tensor<1x2xi32>) -> tensor<?xf32>
  %307 = "tfl.pack"(%306) {axis = 0 : i32, values_count = 1 : i32} : (tensor<?xf32>) -> tensor<1x?xf32>
  %308 = "tfl.cast"(%307) : (tensor<1x?xf32>) -> tensor<1x?xi32>
  %309 = "tfl.cast"(%308) : (tensor<1x?xi32>) -> tensor<1x?xf32>
  %310 = "tfl.gather"(%261, %275) {axis = 0 : i32} : (tensor<?x2xf32>, tensor<?xi32>) -> tensor<?x2xf32>
  %311 = "tfl.gather"(%310, %272) {axis = 0 : i32} : (tensor<?x2xf32>, tensor<?xi32>) -> tensor<?x2xf32>
  %312 = "tfl.shape"(%311) : (tensor<?x2xf32>) -> tensor<2xi32>
  %313 = "tfl.strided_slice"(%312, %cst_214, %cst_216, %cst_216) {begin_mask = 0 : i32, ellipsis_mask = 0 : i32, end_mask = 0 : i32, new_axis_mask = 0 : i32, shrink_axis_mask = 1 : i32} : (tensor<2xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<i32>
  %314 = "tfl.sub"(%313, %cst_7) {fused_activation_function = "NONE"} : (tensor<i32>, tensor<i32>) -> tensor<i32>
  %315 = "tfl.greater"(%314, %cst_21) : (tensor<i32>, tensor<i32>) -> tensor<i1>
  %316 = "tfl.select"(%315, %cst_7, %cst_12) : (tensor<i1>, tensor<i32>, tensor<i32>) -> tensor<i32>
  %317 = "tfl.strided_slice"(%312, %cst_216, %cst_215, %cst_216) {begin_mask = 0 : i32, ellipsis_mask = 0 : i32, end_mask = 0 : i32, new_axis_mask = 0 : i32, shrink_axis_mask = 1 : i32} : (tensor<2xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<i32>
  %318 = "tfl.sub"(%317, %cst_16) {fused_activation_function = "NONE"} : (tensor<i32>, tensor<i32>) -> tensor<i32>
  %319 = "tfl.greater"(%318, %cst_21) : (tensor<i32>, tensor<i32>) -> tensor<i1>
  %320 = "tfl.select"(%319, %cst_16, %cst_12) : (tensor<i1>, tensor<i32>, tensor<i32>) -> tensor<i32>
  %321 = "tfl.pack"(%316, %320) {axis = 0 : i32, values_count = 2 : i32} : (tensor<i32>, tensor<i32>) -> tensor<2xi32>
  %322 = "tfl.slice"(%311, %cst_9, %321) : (tensor<?x2xf32>, tensor<2xi32>, tensor<2xi32>) -> tensor<?x?xf32>
  %323 = "tfl.shape"(%322) : (tensor<?x?xf32>) -> tensor<2xi32>
  %324 = "tfl.strided_slice"(%323, %cst_214, %cst_216, %cst_216) {begin_mask = 0 : i32, ellipsis_mask = 0 : i32, end_mask = 0 : i32, new_axis_mask = 0 : i32, shrink_axis_mask = 1 : i32} : (tensor<2xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<i32>
  %325 = "tfl.sub"(%cst_7, %324) {fused_activation_function = "NONE"} : (tensor<i32>, tensor<i32>) -> tensor<i32>
  %326 = "tfl.strided_slice"(%323, %cst_216, %cst_215, %cst_216) {begin_mask = 0 : i32, ellipsis_mask = 0 : i32, end_mask = 0 : i32, new_axis_mask = 0 : i32, shrink_axis_mask = 1 : i32} : (tensor<2xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<i32>
  %327 = "tfl.sub"(%cst_16, %326) {fused_activation_function = "NONE"} : (tensor<i32>, tensor<i32>) -> tensor<i32>
  %328 = "tfl.pack"(%325, %327) {axis = 0 : i32, values_count = 2 : i32} : (tensor<i32>, tensor<i32>) -> tensor<2xi32>
  %329 = "tfl.pack"(%cst_9, %328) {axis = 1 : i32, values_count = 2 : i32} : (tensor<2xi32>, tensor<2xi32>) -> tensor<2x2xi32>
  %330 = "tfl.pad"(%322, %329) : (tensor<?x?xf32>, tensor<2x2xi32>) -> tensor<?x?xf32>
  %331 = "tfl.pack"(%330) {axis = 0 : i32, values_count = 1 : i32} : (tensor<?x?xf32>) -> tensor<1x?x?xf32>
  %332 = "tfl.gather"(%262, %275) {axis = 0 : i32} : (tensor<?xf32>, tensor<?xi32>) -> tensor<?xf32>
  %333 = "tfl.gather"(%332, %272) {axis = 0 : i32} : (tensor<?xf32>, tensor<?xi32>) -> tensor<?xf32>
  %334 = "tfl.shape"(%333) : (tensor<?xf32>) -> tensor<1xi32>
  %335 = "tfl.strided_slice"(%334, %cst_214, %cst_216, %cst_216) {begin_mask = 0 : i32, ellipsis_mask = 0 : i32, end_mask = 0 : i32, new_axis_mask = 0 : i32, shrink_axis_mask = 1 : i32} : (tensor<1xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<i32>
  %336 = "tfl.sub"(%335, %cst_7) {fused_activation_function = "NONE"} : (tensor<i32>, tensor<i32>) -> tensor<i32>
  %337 = "tfl.greater"(%336, %cst_21) : (tensor<i32>, tensor<i32>) -> tensor<i1>
  %338 = "tfl.select"(%337, %cst_7, %cst_12) : (tensor<i1>, tensor<i32>, tensor<i32>) -> tensor<i32>
  %339 = "tfl.pack"(%338) {axis = 0 : i32, values_count = 1 : i32} : (tensor<i32>) -> tensor<1xi32>
  %340 = "tfl.slice"(%333, %cst_214, %339) : (tensor<?xf32>, tensor<1xi32>, tensor<1xi32>) -> tensor<?xf32>
  %341 = "tfl.shape"(%340) : (tensor<?xf32>) -> tensor<1xi32>
  %342 = "tfl.strided_slice"(%341, %cst_214, %cst_216, %cst_216) {begin_mask = 0 : i32, ellipsis_mask = 0 : i32, end_mask = 0 : i32, new_axis_mask = 0 : i32, shrink_axis_mask = 1 : i32} : (tensor<1xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<i32>
  %343 = "tfl.sub"(%cst_7, %342) {fused_activation_function = "NONE"} : (tensor<i32>, tensor<i32>) -> tensor<i32>
  %344 = "tfl.pack"(%343) {axis = 0 : i32, values_count = 1 : i32} : (tensor<i32>) -> tensor<1xi32>
  %345 = "tfl.pack"(%cst_214, %344) {axis = 1 : i32, values_count = 2 : i32} : (tensor<1xi32>, tensor<1xi32>) -> tensor<1x2xi32>
  %346 = "tfl.pad"(%340, %345) : (tensor<?xf32>, tensor<1x2xi32>) -> tensor<?xf32>
  %347 = "tfl.pack"(%346) {axis = 0 : i32, values_count = 1 : i32} : (tensor<?xf32>) -> tensor<1x?xf32>
  %348 = "tfl.add"(%347, %cst_26) {fused_activation_function = "NONE"} : (tensor<1x?xf32>, tensor<f32>) -> tensor<1x?xf32>
  %349 = "tfl.gather"(%266, %275) {axis = 0 : i32} : (tensor<?x4xf32>, tensor<?xi32>) -> tensor<?x4xf32>
  %350 = "tfl.gather"(%349, %272) {axis = 0 : i32} : (tensor<?x4xf32>, tensor<?xi32>) -> tensor<?x4xf32>
  %351 = "tfl.shape"(%350) : (tensor<?x4xf32>) -> tensor<2xi32>
  %352 = "tfl.strided_slice"(%351, %cst_214, %cst_216, %cst_216) {begin_mask = 0 : i32, ellipsis_mask = 0 : i32, end_mask = 0 : i32, new_axis_mask = 0 : i32, shrink_axis_mask = 1 : i32} : (tensor<2xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<i32>
  %353 = "tfl.sub"(%352, %cst_7) {fused_activation_function = "NONE"} : (tensor<i32>, tensor<i32>) -> tensor<i32>
  %354 = "tfl.greater"(%353, %cst_21) : (tensor<i32>, tensor<i32>) -> tensor<i1>
  %355 = "tfl.select"(%354, %cst_7, %cst_12) : (tensor<i1>, tensor<i32>, tensor<i32>) -> tensor<i32>
  %356 = "tfl.strided_slice"(%351, %cst_216, %cst_215, %cst_216) {begin_mask = 0 : i32, ellipsis_mask = 0 : i32, end_mask = 0 : i32, new_axis_mask = 0 : i32, shrink_axis_mask = 1 : i32} : (tensor<2xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<i32>
  %357 = "tfl.sub"(%356, %cst_6) {fused_activation_function = "NONE"} : (tensor<i32>, tensor<i32>) -> tensor<i32>
  %358 = "tfl.greater"(%357, %cst_21) : (tensor<i32>, tensor<i32>) -> tensor<i1>
  %359 = "tfl.select"(%358, %cst_6, %cst_12) : (tensor<i1>, tensor<i32>, tensor<i32>) -> tensor<i32>
  %360 = "tfl.pack"(%355, %359) {axis = 0 : i32, values_count = 2 : i32} : (tensor<i32>, tensor<i32>) -> tensor<2xi32>
  %361 = "tfl.slice"(%350, %cst_9, %360) : (tensor<?x4xf32>, tensor<2xi32>, tensor<2xi32>) -> tensor<?x?xf32>
  %362 = "tfl.shape"(%361) : (tensor<?x?xf32>) -> tensor<2xi32>
  %363 = "tfl.strided_slice"(%362, %cst_214, %cst_216, %cst_216) {begin_mask = 0 : i32, ellipsis_mask = 0 : i32, end_mask = 0 : i32, new_axis_mask = 0 : i32, shrink_axis_mask = 1 : i32} : (tensor<2xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<i32>
  %364 = "tfl.sub"(%cst_7, %363) {fused_activation_function = "NONE"} : (tensor<i32>, tensor<i32>) -> tensor<i32>
  %365 = "tfl.strided_slice"(%362, %cst_216, %cst_215, %cst_216) {begin_mask = 0 : i32, ellipsis_mask = 0 : i32, end_mask = 0 : i32, new_axis_mask = 0 : i32, shrink_axis_mask = 1 : i32} : (tensor<2xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>) -> tensor<i32>
  %366 = "tfl.sub"(%cst_6, %365) {fused_activation_function = "NONE"} : (tensor<i32>, tensor<i32>) -> tensor<i32>
  %367 = "tfl.pack"(%364, %366) {axis = 0 : i32, values_count = 2 : i32} : (tensor<i32>, tensor<i32>) -> tensor<2xi32>
  %368 = "tfl.pack"(%cst_9, %367) {axis = 1 : i32, values_count = 2 : i32} : (tensor<2xi32>, tensor<2xi32>) -> tensor<2x2xi32>
  %369 = "tfl.pad"(%361, %368) : (tensor<?x?xf32>, tensor<2x2xi32>) -> tensor<?x?xf32>
  %370 = "tfl.pack"(%369) {axis = 0 : i32, values_count = 1 : i32} : (tensor<?x?xf32>) -> tensor<1x?x?xf32>
  "std.return"(%274, %370, %348, %189, %291, %168, %331, %309) : (tensor<1xf32>, tensor<1x?x?xf32>, tensor<1x?xf32>, tensor<1x51150x2xf32>, tensor<1x?xf32>, tensor<1x51150x4xf32>, tensor<1x?x?xf32>, tensor<1x?xf32>) -> ()
}) {arg0 = {tf_saved_model.index_path = ["input_tensor"]}, result0 = {tf_saved_model.index_path = ["num_detections"]}, result1 = {tf_saved_model.index_path = ["detection_boxes"]}, result2 = {tf_saved_model.index_path = ["detection_classes"]}, result3 = {tf_saved_model.index_path = ["raw_detection_scores"]}, result4 = {tf_saved_model.index_path = ["detection_scores"]}, result5 = {tf_saved_model.index_path = ["raw_detection_boxes"]}, result6 = {tf_saved_model.index_path = ["detection_multiclass_scores"]}, result7 = {tf_saved_model.index_path = ["detection_anchor_indices"]}, sym_name = "main", tf.entry_function = {control_outputs = "", inputs = "serving_default_input_tensor:0", outputs = "StatefulPartitionedCall:5,StatefulPartitionedCall:1,StatefulPartitionedCall:2,StatefulPartitionedCall:7,StatefulPartitionedCall:4,StatefulPartitionedCall:6,StatefulPartitionedCall:3,StatefulPartitionedCall:0"}, tf_saved_model.exported_names = ["serving_default"], type = (tensor<1x?x?x3xui8>) -> (tensor<1xf32>, tensor<1x?x?xf32>, tensor<1x?xf32>, tensor<1x51150x2xf32>, tensor<1x?xf32>, tensor<1x51150x4xf32>, tensor<1x?x?xf32>, tensor<1x?xf32>)} : () -> ()

I don´t know what to do with this output though....

PS: I´m using tf-nightly

ItsMeTheBee commented 3 years ago

@tombstone @jch1 @pkulzc I´d be glad about some support on this issue :)

ItsMeTheBee commented 3 years ago

Using the config file & the code from this issue https://github.com/tensorflow/models/issues/9033 I´ve been able to convert a model to tflite with quantization. I´ll compare the config files a bit to find out why it does not work with the ssd networks I trained before. I still think this issue tracker and the code used there should be referenced somewhere / documented / whatever since I had a hard time finding this (because I always searched for quantization since the conversion to tflite itself was not the problem).

DeRealMorgan commented 3 years ago

@ItsMeTheBee can you share how you converted the model to tflite with me? I am probably having the same error, but I cant even get my tflite model up and running. Thanks!

ItsMeTheBee commented 3 years ago

@DeRealMorgan I literally copied all the steps, skripts etc. mentioned here https://github.com/tensorflow/models/issues/9033#issuecomment-694852560 and trained a network with the config file shown there - that worked well. I did not manage to get it to work with my original mobilenet ssd v2 network or my ssd resnet network but I´ll look into that. You should also read the comment after the linked one to get it to work for the edge tpu because you need to make one small adjustment to the code in the linked comment. For simply converting it to tflite without any optimization you don´t need a representative dataset or the whole int8 stuff so this worked fine for me (only testen on mobilenet ssd v2 models):

import os import numpy as np import tensorflow as tf from tensorflow.keras.models import load_model from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.applications.mobilenet import preprocess_input

converter = tf.lite.TFLiteConverter.from_saved_model('PATH/TO/saved_model')

converter.experimental_new_converter = True 
converter.allow_custom_ops = True
tflite_model = converter.convert()

with open('PATH/TO/neuralnet.tflite', 'wb') as f:
  f.write(tflite_model)

If you want to test your model this script might come in handy.