Make some "experimental" feature flag private
And also removes all the related api documentation. PiperOrigin-RevId: 303006102 Change-Id: Id135e802e6007e98f30e48a8232a51f7150c7aaa
This commit is contained in:
parent
b6016957b3
commit
e6895b3648
@ -174,8 +174,8 @@ class TFLiteConverterBase(object):
|
|||||||
self.optimizations = []
|
self.optimizations = []
|
||||||
self.representative_dataset = None
|
self.representative_dataset = None
|
||||||
self.experimental_new_converter = _USE_EXPERIMENTAL_NEW_CONVERTER
|
self.experimental_new_converter = _USE_EXPERIMENTAL_NEW_CONVERTER
|
||||||
self.experimental_new_quantizer = False
|
self._experimental_new_quantizer = False
|
||||||
self.experimental_calibrate_only = False
|
self._experimental_calibrate_only = False
|
||||||
# The 'GraphDebugInfo' contains the stack traces of all the original nodes
|
# The 'GraphDebugInfo' contains the stack traces of all the original nodes
|
||||||
# in the `GraphDef` to the converter.
|
# in the `GraphDef` to the converter.
|
||||||
self._debug_info = None
|
self._debug_info = None
|
||||||
@ -259,7 +259,7 @@ class TFLiteConverterBase(object):
|
|||||||
inference_output_type):
|
inference_output_type):
|
||||||
allow_float = not self._is_int8_target_required()
|
allow_float = not self._is_int8_target_required()
|
||||||
calibrate_quantize = _calibrator.Calibrator(result)
|
calibrate_quantize = _calibrator.Calibrator(result)
|
||||||
if self.experimental_calibrate_only:
|
if self._experimental_calibrate_only:
|
||||||
return calibrate_quantize.calibrate(self.representative_dataset.input_gen)
|
return calibrate_quantize.calibrate(self.representative_dataset.input_gen)
|
||||||
else:
|
else:
|
||||||
return calibrate_quantize.calibrate_and_quantize(
|
return calibrate_quantize.calibrate_and_quantize(
|
||||||
@ -317,11 +317,6 @@ class TFLiteConverterV2(TFLiteConverterBase):
|
|||||||
dataset to evaluate different optimizations.
|
dataset to evaluate different optimizations.
|
||||||
experimental_new_converter: Experimental flag, subject to change.
|
experimental_new_converter: Experimental flag, subject to change.
|
||||||
Enables MLIR-based conversion instead of TOCO conversion.
|
Enables MLIR-based conversion instead of TOCO conversion.
|
||||||
experimental_new_quantizer: Experimental flag, subject to change.
|
|
||||||
Enables MLIR-based post-training quantization.
|
|
||||||
experimental_calibrate_only: Experimental flag, subject to change.
|
|
||||||
Calibrates the converted model with representative dataset, but not
|
|
||||||
quantize it.
|
|
||||||
Example usage:
|
Example usage:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
@ -609,11 +604,6 @@ class TFLiteConverter(TFLiteConverterBase):
|
|||||||
the dataset to evaluate different optimizations.
|
the dataset to evaluate different optimizations.
|
||||||
experimental_new_converter: Experimental flag, subject to change.
|
experimental_new_converter: Experimental flag, subject to change.
|
||||||
Enables MLIR-based conversion instead of TOCO conversion.
|
Enables MLIR-based conversion instead of TOCO conversion.
|
||||||
experimental_new_quantizer: Experimental flag, subject to change.
|
|
||||||
Enables MLIR-based post-training quantization.
|
|
||||||
experimental_calibrate_only: Experimental flag, subject to change.
|
|
||||||
Calibrates the converted model with representative dataset, but not
|
|
||||||
quantize it.
|
|
||||||
Example usage:
|
Example usage:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
@ -296,11 +296,11 @@ class FromConcreteFunctionTest(TestModels):
|
|||||||
quantized_converter.representative_dataset = calibration_gen
|
quantized_converter.representative_dataset = calibration_gen
|
||||||
|
|
||||||
# default quantizer
|
# default quantizer
|
||||||
quantized_converter.experimental_new_quantizer = False
|
quantized_converter._experimental_new_quantizer = False
|
||||||
old_tflite = quantized_converter.convert()
|
old_tflite = quantized_converter.convert()
|
||||||
|
|
||||||
# new quantizer
|
# new quantizer
|
||||||
quantized_converter.experimental_new_quantizer = True
|
quantized_converter._experimental_new_quantizer = True
|
||||||
new_tflite = quantized_converter.convert()
|
new_tflite = quantized_converter.convert()
|
||||||
|
|
||||||
for _ in range(5):
|
for _ in range(5):
|
||||||
|
Loading…
Reference in New Issue
Block a user