Skip to content

Commit fcaa230

Browse files
alanchiaotensorflower-gardener
authored andcommitted
Disable more QAT layers with no path to full-integer deployment, ignoring inputs and outputs.
PiperOrigin-RevId: 305135961
1 parent d384442 commit fcaa230

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

tensorflow_model_optimization/python/core/quantization/keras/default_8bit/default_8bit_quantize_registry.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ class QuantizeRegistry(quantize_registry.QuantizeRegistry, _RNNHelper):
7575
# TODO(tfmot): expand layers test in quantize_functional_test.py
7676
# to add more layers to whitelist.
7777
_LAYER_QUANTIZE_INFO = [
78-
7978
# Activation Layers
8079
_QuantizeInfo(layers.ReLU, [], [], True),
8180
_QuantizeInfo(layers.Softmax, [], []),
@@ -89,19 +88,20 @@ class QuantizeRegistry(quantize_registry.QuantizeRegistry, _RNNHelper):
8988
# _QuantizeInfo(layers.Conv1D, ['kernel'], ['activation']),
9089

9190
# layers.Conv2D is supported and handled in code below.
91+
# layers.DepthwiseConv2D is supported and handled in code below.
9292

9393
# _QuantizeInfo(layers.Conv3D, ['kernel'], ['activation']),
9494
# _QuantizeInfo(layers.Conv2DTranspose, ['kernel'], ['activation']),
9595
# _QuantizeInfo(layers.Conv3DTranspose, ['kernel'], ['activation']),
9696
_no_quantize(layers.Cropping1D),
9797
_no_quantize(layers.Cropping2D),
9898
_no_quantize(layers.Cropping3D),
99-
_no_quantize(layers.UpSampling1D),
99+
# _no_quantize(layers.UpSampling1D),
100100
# _no_quantize(layers.UpSampling2D),
101-
_no_quantize(layers.UpSampling3D),
101+
# _no_quantize(layers.UpSampling3D),
102102
_no_quantize(layers.ZeroPadding1D),
103103
_no_quantize(layers.ZeroPadding2D),
104-
_no_quantize(layers.ZeroPadding3D),
104+
# _no_quantize(layers.ZeroPadding3D),
105105
# Enable once verified.
106106
# layers.SeparableConv1D,
107107
# layers.SeparableConv2D,
@@ -113,7 +113,7 @@ class QuantizeRegistry(quantize_registry.QuantizeRegistry, _RNNHelper):
113113
_no_quantize(layers.Flatten),
114114
# _no_quantize(layers.Masking),
115115
_no_quantize(layers.Permute),
116-
_no_quantize(layers.RepeatVector),
116+
# _no_quantize(layers.RepeatVector),
117117
_no_quantize(layers.Reshape),
118118
_no_quantize(layers.SpatialDropout1D),
119119
_no_quantize(layers.SpatialDropout2D),
@@ -130,7 +130,7 @@ class QuantizeRegistry(quantize_registry.QuantizeRegistry, _RNNHelper):
130130
_no_quantize(layers.GlobalMaxPooling1D),
131131
_no_quantize(layers.GlobalMaxPooling2D),
132132
_no_quantize(layers.GlobalMaxPooling3D),
133-
_no_quantize(layers.MaxPooling1D),
133+
# _no_quantize(layers.MaxPooling1D),
134134
_no_quantize(layers.MaxPooling2D),
135135
# _no_quantize(layers.MaxPooling3D),
136136

@@ -140,7 +140,10 @@ class QuantizeRegistry(quantize_registry.QuantizeRegistry, _RNNHelper):
140140

141141
# Enable once verified with TFLite behavior.
142142
# layers.Embedding: ['embeddings'],
143-
# layers.BatchNormalization: [],
143+
144+
# BatchNormalization is handled elsewhere, in the cases
145+
# where it's preceded by convolutional layers or a Dense layer.
146+
# layers.BatchNormalization: [],
144147

145148
# Merge layers to be added.
146149

0 commit comments

Comments
 (0)