Skip to content

Commit f9ce0c1

Browse files
Merge pull request #607 from jessicayywu:patch-1
PiperOrigin-RevId: 373090008
2 parents 9c721cf + 0da7a4e commit f9ce0c1

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,8 @@ def replacement(self, match_layer):
482482
)
483483
conv_weights = collections.OrderedDict()
484484
conv_weights['kernel:0'] = sepconv_weights[1]
485-
conv_weights['bias:0'] = sepconv_weights[2]
485+
if sepconv_layer['config']['use_bias']:
486+
conv_weights['bias:0'] = sepconv_weights[2]
486487
conv_layer_config = keras.layers.serialize(conv_layer)
487488
conv_layer_config['name'] = conv_layer.name
488489
# Needed to ensure these new layers are considered for quantization.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ def testSeparableConv1DQuantize_(self, kwargs):
301301
'pointwise_regularizer': 'l2',
302302
'bias_regularizer': 'l2',
303303
'activity_regularizer': 'l2'}),
304+
('use_bias', {'use_bias': False}),
304305
('constraint', {
305306
'depthwise_constraint': tf.keras.constraints.max_norm(2.),
306307
'pointwise_constraint': tf.keras.constraints.min_max_norm(0., 2.),

0 commit comments

Comments
 (0)