pytorch
39aac654 - [quant][bug] Fixing the mapping getter to return a copy (#50297)

Commit
3 years ago
[quant][bug] Fixing the mapping getter to return a copy (#50297) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/50297 Current implementation has a potential bug: if a user modifies the quantization mappings returned by the getters, the changes will propagate. For example, the bug will manifest itself if the user does the following: ``` my_mapping = get_default_static_quant_module_mappings() my_mapping[nn.Linear] = UserLinearImplementation model_A = convert(model_A, mapping=my_mapping) default_mapping = get_default_static_quant_module_mappings() model_B = convert(model_B, mapping=default_mapping) ``` In that case the `model_B` will be quantized with with the modified mapping. Test Plan: Imported from OSS Reviewed By: vkuzo Differential Revision: D25855753 Pulled By: z-a-f fbshipit-source-id: 0149a0c07a965024ba7d1084e89157a9c8fa1192
Author
Parents
Loading