title: TFLite model conversion shows warning and using the converted model with interpreter crashes python kernel
body: <p>I have a tensorflow keras model which has the following architecture:</p>
  <pre><code>Model: &quot;model_2&quot;
  _________________________________________________________________
   Layer (type)                Output Shape              Param #   
  =================================================================
   input_3 (InputLayer)        [(None, 199)]             0         
                                                                   
   token_and_position_embeddin  (None, 199, 256)         2611456   
   g_2 (TokenAndPositionEmbedd                                     
   ing)                                                            
                                                                   
   lstm_4 (LSTM)               (None, 199, 150)          244200    
                                                                   
   lstm_5 (LSTM)               (None, 150)               180600    
                                                                   
   dense_2 (Dense)             (None, 10001)             1510151   
                                                                   
  =================================================================
  Total params: 4,546,407
  Trainable params: 4,546,407
  Non-trainable params: 0
  _________________________________________________________________
  
  
  </code></pre>
  <p>I am trying to convert it to tflite in this way:</p>
  <pre class="lang-py prettyprint-override"><code>converter = tf.lite.TFLiteConverter.from_saved_model(str(model_saved_dir))
  converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS, tf.lite.OpsSet.SELECT_TF_OPS]
  converter.target_spec.supported_types = [tf.float16]
  converter.optimizations = [tf.lite.Optimize.DEFAULT]
  tflite_model = converter.convert()
  # Save the model.
  with open(model_home / 'model.tflite', 'wb') as f:
      f.write(tflite_model)
  </code></pre>
  <p>During conversion it shows the following warnings:</p>
  <pre><code>2022-04-12 20:17:23.584937: I tensorflow/cc/saved_model/loader.cc:301] SavedModel load for tags { serve }; Status: success: OK. Took 329307 microseconds.
  2022-04-12 20:17:23.771051: I tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.cc:237] disabling MLIR crash reproducer, set env var `MLIR_CRASH_REPRODUCER_DIRECTORY` to enable.
  2022-04-12 20:17:23.983377: W tensorflow/compiler/mlir/lite/flatbuffer_export.cc:1892] TFLite interpreter needs to link Flex delegate in order to run the model since it contains the following Select TFop(s):
  Flex ops: FlexTensorListFromTensor, FlexTensorListGetItem, FlexTensorListReserve, FlexTensorListSetItem, FlexTensorListStack
  Details:
      tf.TensorListFromTensor(tensor&lt;199x?x256xf32&gt;, tensor&lt;2xi32&gt;) -&gt; (tensor&lt;!tf_type.variant&lt;tensor&lt;?x256xf32&gt;&gt;&gt;) : {device = &quot;&quot;}
      tf.TensorListFromTensor(tensor&lt;?x?x150xf32&gt;, tensor&lt;2xi32&gt;) -&gt; (tensor&lt;!tf_type.variant&lt;tensor&lt;?x150xf32&gt;&gt;&gt;) : {device = &quot;&quot;}
      tf.TensorListGetItem(tensor&lt;!tf_type.variant&lt;tensor&lt;?x150xf32&gt;&gt;&gt;, tensor&lt;i32&gt;, tensor&lt;2xi32&gt;) -&gt; (tensor&lt;?x150xf32&gt;) : {device = &quot;&quot;}
      tf.TensorListGetItem(tensor&lt;!tf_type.variant&lt;tensor&lt;?x256xf32&gt;&gt;&gt;, tensor&lt;i32&gt;, tensor&lt;2xi32&gt;) -&gt; (tensor&lt;?x256xf32&gt;) : {device = &quot;&quot;}
      tf.TensorListReserve(tensor&lt;2xi32&gt;, tensor&lt;i32&gt;) -&gt; (tensor&lt;!tf_type.variant&lt;tensor&lt;?x150xf32&gt;&gt;&gt;) : {device = &quot;&quot;}
      tf.TensorListSetItem(tensor&lt;!tf_type.variant&lt;tensor&lt;?x150xf32&gt;&gt;&gt;, tensor&lt;i32&gt;, tensor&lt;?x150xf32&gt;) -&gt; (tensor&lt;!tf_type.variant&lt;tensor&lt;?x150xf32&gt;&gt;&gt;) : {device = &quot;&quot;}
      tf.TensorListStack(tensor&lt;!tf_type.variant&lt;tensor&lt;?x150xf32&gt;&gt;&gt;, tensor&lt;2xi32&gt;) -&gt; (tensor&lt;?x?x150xf32&gt;) : {device = &quot;&quot;, num_elements = -1 : i64}
  See instructions: https://www.tensorflow.org/lite/guide/ops_select
  WARNING:absl:Buffer deduplication procedure will be skipped when flatbuffer library is not properly loaded
  
  </code></pre>
  <p>But the file is created after this and when trying to use this model in this way:</p>
  <pre class="lang-py prettyprint-override"><code>interpreter = tf.lite.Interpreter(model_path=str(model_home / 'model.tflite'))
  interpreter.allocate_tensors()
  input_index = interpreter.get_input_details()[0][&quot;index&quot;]
  output_index = interpreter.get_output_details()[0][&quot;index&quot;]
  
  # dummy input
  ip = [[0 for _ in range(198)] + [1]]
  ip = np.array(ip, dtype=np.int32)
  
  interpreter.set_tensor(input_index, ip)
  interpreter.invoke()
  predictions = interpreter.get_tensor(output_index)
  print(predictions)
  </code></pre>
  <p>my jupyter notebook kernel dies and python program crashes. My tensorflow version is '2.8.0' and python version is '3.8.10'. When I try to use the model from Android studio it also crashes showing error <code>ByteBuffer is not a valid FlatBuffer model</code>.</p>