Skip to content

Commit 8465279

Browse files
nutsiepullytensorflower-gardener
authored andcommitted
Use tf_inspect for quantize_wrapper for py2
TFL Micro has a model which uses py2 and fails, so adding this in for support PiperOrigin-RevId: 321405008
1 parent 8169858 commit 8465279

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tensorflow_model_optimization/python/core/quantization/keras/quantize_wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
from __future__ import division
2727
from __future__ import print_function
2828

29-
import inspect
3029
import tensorflow as tf
3130

3231
# TODO(b/139939526): move to public API.
3332
from tensorflow.python.keras.utils import tf_utils
33+
from tensorflow.python.util import tf_inspect
3434
from tensorflow_model_optimization.python.core.quantization.keras import quantize_aware_activation
3535

3636
deserialize_keras_object = tf.keras.utils.deserialize_keras_object
@@ -160,7 +160,7 @@ def call(self, inputs, training=None):
160160
self.quantize_config.set_quantize_activations(self.layer,
161161
self._quantize_activations)
162162

163-
args = inspect.getfullargspec(self.layer.call).args
163+
args = tf_inspect.getfullargspec(self.layer.call).args
164164
if 'training' in args:
165165
outputs = self.layer.call(inputs, training=training)
166166
else:

0 commit comments

Comments
 (0)