Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def replace_module_by_nncf_module(module: nn.Module):
for nncf_module_type, module_type in NNCF_MODULES_DICT.items():
if module.__class__.__name__ == module_type.__name__:
nncf_module = module
if not module.__class__.__name__ == nncf_module_type.__name__:
nncf_module = nncf_module_type.from_module(module)
return nncf_module
return module