r"""Set quantization related configs with ``qconfig``, including observer and fake_quant for weight and activation.
(self, qconfig: QConfig)
| 35 | return "QAT." + super().__repr__() |
| 36 | |
| 37 | def set_qconfig(self, qconfig: QConfig): |
| 38 | r"""Set quantization related configs with ``qconfig``, including |
| 39 | observer and fake_quant for weight and activation. |
| 40 | """ |
| 41 | |
| 42 | def safe_call(func): |
| 43 | return func() if func is not None else None |
| 44 | |
| 45 | if self.with_act: |
| 46 | self.act_observer = safe_call(qconfig.act_observer) |
| 47 | self.act_fake_quant = safe_call(qconfig.act_fake_quant) |
| 48 | if self.with_weight: |
| 49 | self.weight_observer = safe_call(qconfig.weight_observer) |
| 50 | self.weight_fake_quant = safe_call(qconfig.weight_fake_quant) |
| 51 | |
| 52 | def _enable_exec(self, with_module, func, enable): |
| 53 | if not with_module or not func: |
nothing calls this directly
no test coverage detected