File tree Expand file tree Collapse file tree 6 files changed +8
-15
lines changed
tensorflow_model_optimization/python/core/quantization/keras Expand file tree Collapse file tree 6 files changed +8
-15
lines changed Original file line number Diff line number Diff line change 1818from __future__ import division
1919from __future__ import print_function
2020
21- from absl .testing import parameterized
2221import tensorflow as tf
2322
2423# TODO(b/139939526): move to public API.
25- from tensorflow .python .keras import keras_parameterized
2624from tensorflow_model_optimization .python .core .keras import compat
2725from tensorflow_model_optimization .python .core .quantization .keras import quant_ops
2826
2927_SYMMETRIC_RANGE_RATIO = 0.9921875 # 127 / 128
3028
3129
32- @keras_parameterized .run_all_keras_modes
33- class QuantOpsTest (tf .test .TestCase , parameterized .TestCase ):
30+ class QuantOpsTest (tf .test .TestCase ):
3431
3532 def testAllValuesQuantiize_TrainingAssign (self ):
3633 min_value , max_value = self ._GetMinMaxValues (
Original file line number Diff line number Diff line change 2323import numpy as np
2424import tensorflow as tf
2525
26- from tensorflow .python .keras import keras_parameterized
2726from tensorflow_model_optimization .python .core .quantization .keras import quantize_aware_activation
2827from tensorflow_model_optimization .python .core .quantization .keras import quantizers
2928
3736MovingAverageQuantizer = quantizers .MovingAverageQuantizer
3837
3938
40- @keras_parameterized .run_all_keras_modes
39+ @tf .__internal__ .distribute .combinations .generate (
40+ tf .__internal__ .test .combinations .combine (mode = ['graph' , 'eager' ]))
4141class QuantizeAwareQuantizationTest (tf .test .TestCase , parameterized .TestCase ):
4242
4343 def setUp (self ):
Original file line number Diff line number Diff line change 2525import tensorflow as tf
2626
2727# TODO(b/139939526): move to public API.
28- from tensorflow .python .keras import keras_parameterized
2928from tensorflow_model_optimization .python .core .keras import compat
3029from tensorflow_model_optimization .python .core .keras .testing import test_utils_mnist
3130from tensorflow_model_optimization .python .core .quantization .keras import quantize
3433layers = tf .keras .layers
3534
3635
37- @keras_parameterized .run_all_keras_modes (always_skip_v1 = True )
38- class QuantizeFunctionalTest (tf .test .TestCase , parameterized .TestCase ):
36+ @tf .__internal__ .distribute .combinations .generate (
37+ tf .__internal__ .test .combinations .combine (mode = ['graph' , 'eager' ]))
38+ class QuantizeFunctionalTest (tf .test .TestCase ):
3939
4040 # TODO(pulkitb): Parameterize test and include functional mnist, and
4141 # other RNN models.
Original file line number Diff line number Diff line change 2626import tensorflow as tf
2727
2828# TODO(b/139939526): move to public API.
29- from tensorflow .python .keras import keras_parameterized
3029
3130from tensorflow_model_optimization .python .core .keras import compat
3231from tensorflow_model_optimization .python .core .keras import test_utils
4443# TODO(tfmot): enable for v1. Currently fails because the decorator
4544# on graph mode wraps everything in a graph, which is not compatible
4645# with the TFLite converter's call to clear_session().
47- @keras_parameterized .run_all_keras_modes (always_skip_v1 = True )
46+ @tf .__internal__ .distribute .combinations .generate (
47+ tf .__internal__ .test .combinations .combine (mode = ['graph' , 'eager' ]))
4848class QuantizeIntegrationTest (tf .test .TestCase , parameterized .TestCase ):
4949
5050 def _batch (self , dims , batch_size ):
Original file line number Diff line number Diff line change 2626import numpy as np
2727import tensorflow as tf
2828
29- from tensorflow .python .keras import keras_parameterized
3029from tensorflow_model_optimization .python .core .quantization .keras import quantize
3130from tensorflow_model_optimization .python .core .quantization .keras import utils
3231
3332
34- @keras_parameterized .run_all_keras_modes (always_skip_v1 = True )
3533class QuantizeModelsTest (tf .test .TestCase , parameterized .TestCase ):
3634
3735 # Derived using
Original file line number Diff line number Diff line change 2323import numpy as np
2424import tensorflow as tf
2525
26- from tensorflow .python .keras import keras_parameterized
2726from tensorflow_model_optimization .python .core .keras import compat
2827from tensorflow_model_optimization .python .core .quantization .keras import quantizers
2928
3029deserialize_keras_object = tf .keras .utils .deserialize_keras_object
3130serialize_keras_object = tf .keras .utils .serialize_keras_object
3231
3332
34- @keras_parameterized .run_all_keras_modes
3533@parameterized .parameters (
3634 quantizers .LastValueQuantizer ,
3735 quantizers .MovingAverageQuantizer ,
You can’t perform that action at this time.
0 commit comments