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 320 forks source link

QAT for subclass inside the subclass #996

Open t7hua opened 2 years ago

t7hua commented 2 years ago

I have one subclass A, which contains another subclass B inside it. I find subclass B in fact didn't get quanted. class A (): self.layers=[] self.layers.append(Dense) self.layers.append(class B)

class A_quant(A): self.layers[0]=QuantizeWrapperV2(Dense, quant_config) _config=B.get_config() quant_layer=B_quant.from_config(_config) self.layers[1]=quant_layer

Well, everything runs fine of quant_anonatize and quant_apply. Then I find only the Dense in Class A is quant, the denses in Class B doesn't get quant.

dansuh17 commented 2 years ago

@Xhark could you take a look at this issue?

Xhark commented 2 years ago

Hi, Would you please explain how did you make Q_quant more details? Is that quantized if you only use B_quant class?