Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def from_module(module):
assert module.__class__.__name__ == nn.Conv2d.__name__
nncf_conv = NNCFConv2d(
module.in_channels, module.out_channels, module.kernel_size, module.stride,
module.padding, module.dilation, module.groups, hasattr(module, 'bias')
)
nncf.utils.dict_update(nncf_conv.__dict__, module.__dict__)
return nncf_conv
def from_module(module):
assert module.__class__.__name__ == nn.ConvTranspose3d.__name__
args = [module.in_channels, module.out_channels, module.kernel_size, module.stride,
module.padding, module.output_padding, module.groups, hasattr(module, 'bias'),
module.dilation]
if hasattr(module, 'padding_mode'):
args.append(module.padding_mode)
nncf_conv_transpose3d = NNCFConvTranspose3d(*args)
nncf.utils.dict_update(nncf_conv_transpose3d.__dict__, module.__dict__)
return nncf_conv_transpose3d