評價此頁

swap_module#

class torch.ao.quantization.swap_module(mod, mapping, custom_module_class_mapping, use_precomputed_fake_quant=False)[源]#

如果模組有量化對應的模組,並且該模組已附加了“觀察者”,則交換該模組。

引數
  • mod – 輸入模組

  • mapping – 一個將 nn 模組對映到 nnq 模組的字典

返回

mod 對應的量化模組