Quantization model

fatemeh_hajizadeh: <p>I want to use “fuse_vonv_bn” method of quantization, my model like this:<br>
(conv_4): Residual(<br>
(model): Sequential(<br>
(0): Depth_Wise(<br>
(conv): Conv_block(<br>
(conv): Conv2d(128, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)<br>
(bn): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)<br>
(prelu): PReLU(num_parameters=256)<br>
)<br>
(conv_dw): Conv_block(<br>
(conv): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=256, bias=False)<br>
(bn): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)<br>
(prelu): PReLU(num_parameters=256)<br>
)<br>
(project): Linear_block(<br>
(conv): Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)<br>
(bn): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)<br>
)<br>
)<br>
(1): Depth_Wise(<br>
(conv): Conv_block(<br>
(conv): Conv2d(128, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)<br>
(bn): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)<br>
(prelu): PReLU(num_parameters=256)<br>
)<br>
(conv_dw): Conv_block(<br>
(conv): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=256, bias=False)<br>
(bn): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)<br>
(prelu): PReLU(num_parameters=256)<br>
)<br>
(project): Linear_block(<br>
(conv): Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)<br>
(bn): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)<br>
)<br>
)<br>
(2): Depth_Wise(<br>
(conv): Conv_block(<br>
(conv): Conv2d(128, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)<br>
(bn): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)<br>
(prelu): PReLU(num_parameters=256)<br>
)<br>
(conv_dw): Conv_block(<br>
(conv): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=256, bias=False)<br>
(bn): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)<br>
(prelu): PReLU(num_parameters=256)<br>
)<br>
(project): Linear_block(<br>
(conv): Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)<br>
(bn): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)<br>
)<br>
)<br>
(3): Depth_Wise(<br>
(conv): Conv_block(<br>
(conv): Conv2d(128, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)<br>
(bn): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)<br>
(prelu): PReLU(num_parameters=256)<br>
)<br>
(conv_dw): Conv_block(<br>
(conv): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=256, bias=False)<br>
(bn): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)<br>
(prelu): PReLU(num_parameters=256)<br>
)<br>
(project): Linear_block(<br>
(conv): Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)<br>
(bn): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)<br>
)<br>
)<br>
(4): Depth_Wise(<br>
(conv): Conv_block(<br>
(conv): Conv2d(128, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)<br>
(bn): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)<br>
(prelu): PReLU(num_parameters=256)<br>
)<br>
(conv_dw): Conv_block(<br>
(conv): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=256, bias=False)<br>
(bn): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)<br>
(prelu): PReLU(num_parameters=256)<br>
)<br>
(project): Linear_block(<br>
(conv): Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)<br>
(bn): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)<br>
)<br>
)<br>
(5): Depth_Wise(<br>
(conv): Conv_block(<br>
(conv): Conv2d(128, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)<br>
(bn): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)<br>
(prelu): PReLU(num_parameters=256)<br>
)<br>
(conv_dw): Conv_block(<br>
(conv): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=256, bias=False)<br>
(bn): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)<br>
(prelu): PReLU(num_parameters=256)<br>
)<br>
(project): Linear_block(<br>
(conv): Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)<br>
(bn): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)<br>
)<br>
)<br>
)<br>
)<br>
when I write “model.conv_4.model.0.conv.conv = quantization.fuse_conv_bn(model.conv_4.model.0.conv.conv, model.conv_4.model.0.conv.bn)”, I get error “SyntaxError: invalid syntax” for using “0” in calling conv layer in “model.conv_4.model.0.conv.conv”<br>
how to access conv layer for using “fuse_conv_bn” method?</p>