tensorflow / model-optimization

A toolkit to optimize ML models for deployment for Keras and TensorFlow, including quantization and pruning.
https://www.tensorflow.org/model_optimization
Apache License 2.0
1.49k stars 319 forks source link

layer is not supported for Quantization aware training #602

Open ZhouKai90 opened 3 years ago

ZhouKai90 commented 3 years ago

System information

RuntimeError: Layer tf_op_layer_ResizeNearestNeighbor:<class 'tensorflow.python.keras.engine.base_layer.TensorFlowOpLayer'> is not supported. You can quantize this layer by passing a tfmot.quantization.keras.QuantizeConfig instance to the quantize_annotate_layer API. RuntimeError: Layer up_sampling2d:<class 'tensorflow.python.keras.layers.convolutional.UpSampling2D'> is not supported. You can quantize this layer by passing a tfmot.quantization.keras.QuantizeConfig instance to the quantize_annotate_layer API.

RuntimeError: Layer conv2d_transpose:<class 'tensorflow.python.keras.layers.convolutional.Conv2DTranspose'> is not supported. You can quantize this layer by passing a tfmot.quantization.keras.QuantizeConfig instance to the quantize_annotate_layer API.

May i ask what's the plan for the support of tf_op_layer_ResizeNearestNeighbor、UpSampling2D and Conv2DTranspose?

sunzhe09 commented 3 years ago

I met a problem is Layer subtract is not supported.You can quantize this layer by passing a tfmot.quantization.keras.QuantizeConfig instance to the quantize_annotate_layer API.

ZhouKai90 commented 3 years ago

I met a problem is Layer subtract is not supported.You can quantize this layer by passing a tfmot.quantization.keras.QuantizeConfig instance to the quantize_annotate_layer API.

Can you give me some example for quantizing this layer?