Add dynamic range scheme to quantization testing

PiperOrigin-RevId: 356175936
Change-Id: Ie9d5b45523ffcd27152f10da768a692c4ed20938
This commit is contained in:
Frederic Rechtenstein 2021-02-07 19:07:06 -08:00 committed by TensorFlower Gardener
parent 40fc414003
commit 93b319bd07
4 changed files with 2 additions and 0 deletions

View File

@ -39,6 +39,7 @@ NUM_CALIBRATION_STEPS = 100
@enum.unique
class QuantizationType(enum.Enum):
DYNAMIC_RANGE = "dynamicRange"
FLOAT16 = "float16"
FULL_INTEGER = "int"
FULL_INTEGER_16X8 = "int16x8"
@ -93,6 +94,7 @@ class ModelQuantizationTest(parameterized.TestCase):
converter.experimental_new_quantizer = True
converter.optimizations = [_lite.Optimize.DEFAULT]
# QuantizationType.DYNAMIC_RANGE: No additional converter option necessary
if quantization_type == QuantizationType.FLOAT16:
converter.target_spec.supported_types = [dtypes.float16]
elif quantization_type in (QuantizationType.FULL_INTEGER,