|
32 | 32 | quantize_annotate = quantize_emulate.quantize_annotate
|
33 | 33 | QuantizeEmulate = quantize_emulate.QuantizeEmulate
|
34 | 34 | QuantizeEmulateWrapper = quantize_emulate_wrapper.QuantizeEmulateWrapper
|
35 |
| -QuantizeAwareActivation = quantize_aware_activation.QuantizeAwareActivation |
36 | 35 |
|
37 | 36 |
|
38 | 37 | class QuantizeEmulateTest(test.TestCase):
|
@@ -270,48 +269,6 @@ def testAppliesQuantizationToAnnotatedModel_Functional(self):
|
270 | 269 |
|
271 | 270 | self._assert_model_emulated(model, quantized_model)
|
272 | 271 |
|
273 |
| - # Transformation Tests |
274 |
| - |
275 |
| - def testQuantizesActivationsWithinLayer_Sequential(self): |
276 |
| - quant_params = {'num_bits': 8, 'symmetric': True} |
277 |
| - model = keras.Sequential([ |
278 |
| - quantize_annotate( |
279 |
| - keras.layers.Conv2D(32, 5, activation='relu'), |
280 |
| - input_shape=(28, 28, 1)) |
281 |
| - ]) |
282 |
| - |
283 |
| - quantized_model = quantize_emulate.quantize_apply(model) |
284 |
| - |
285 |
| - # We expect activation to be modified. |
286 |
| - self._assert_model_emulated(model, quantized_model, ['activation']) |
287 |
| - |
288 |
| - conv_layer = quantized_model.layers[0].layer |
289 |
| - self.assertIsInstance(conv_layer.activation, QuantizeAwareActivation) |
290 |
| - self.assertEqual( |
291 |
| - keras.activations.get('relu'), conv_layer.activation.activation) |
292 |
| - self.assertEqual(keras.layers.Conv2D, conv_layer.activation.parent_layer) |
293 |
| - self.assertEqual(quant_params, conv_layer.activation.get_quantize_params()) |
294 |
| - |
295 |
| - def testQuantizesActivationsWithinLayer_Functional(self): |
296 |
| - quant_params = {'num_bits': 8, 'symmetric': True} |
297 |
| - |
298 |
| - inputs = keras.Input(shape=(28, 28, 1)) |
299 |
| - results = quantize_annotate( |
300 |
| - keras.layers.Conv2D(32, 5, activation='relu'))(inputs) |
301 |
| - model = keras.Model(inputs=inputs, outputs=results) |
302 |
| - |
303 |
| - quantized_model = quantize_emulate.quantize_apply(model) |
304 |
| - |
305 |
| - # We expect activation to be modified. |
306 |
| - self._assert_model_emulated(model, quantized_model, ['activation']) |
307 |
| - |
308 |
| - conv_layer = quantized_model.layers[1].layer |
309 |
| - self.assertIsInstance(conv_layer.activation, QuantizeAwareActivation) |
310 |
| - self.assertEqual( |
311 |
| - keras.activations.get('relu'), conv_layer.activation.activation) |
312 |
| - self.assertEqual(keras.layers.Conv2D, conv_layer.activation.parent_layer) |
313 |
| - self.assertEqual(quant_params, conv_layer.activation.get_quantize_params()) |
314 |
| - |
315 | 272 |
|
316 | 273 | if __name__ == '__main__':
|
317 | 274 | test.main()
|
0 commit comments