Disable per channel quantization for FC layers (#2465) BUG=b/324385802
diff --git a/tensorflow/lite/micro/testing/generate_test_models.py b/tensorflow/lite/micro/testing/generate_test_models.py index 25902d0..2593653 100644 --- a/tensorflow/lite/micro/testing/generate_test_models.py +++ b/tensorflow/lite/micro/testing/generate_test_models.py
@@ -71,6 +71,10 @@ converter.inference_input_type = tf.int8 converter.inference_output_type = tf.int8 converter.representative_dataset = representative_dataset_gen + # TODO(b/324385802): Disable per channel quantization in FC layers (currently + # default behaviour) since it's not yet supported in TFLM. + converter._experimental_disable_per_channel_quantization_for_dense_layers = ( # pylint: disable=protected-access + True) tflite_model = converter.convert() if write_to_file:
diff --git a/tensorflow/lite/micro/tools/requantize_flatbuffer_test.py b/tensorflow/lite/micro/tools/requantize_flatbuffer_test.py index 4d80991..04bbb32 100644 --- a/tensorflow/lite/micro/tools/requantize_flatbuffer_test.py +++ b/tensorflow/lite/micro/tools/requantize_flatbuffer_test.py
@@ -60,6 +60,10 @@ EXPERIMENTAL_TFLITE_BUILTINS_ACTIVATIONS_INT16_WEIGHTS_INT8 ] converter.representative_dataset = representative_dataset_gen + # TODO(b/324385802): Disable per channel quantization in FC layers (currently + # default behaviour) since it's not yet supported in TFLM. + converter._experimental_disable_per_channel_quantization_for_dense_layers = ( # pylint: disable=protected-access + True) return converter.convert()