3x3 convolution with padding
(in_channels, out_channels, module_name, postfix, stride=1, groups=1, kernel_size=3, padding=1)
| 114 | |
| 115 | |
| 116 | def conv3x3(in_channels, out_channels, module_name, postfix, stride=1, groups=1, kernel_size=3, padding=1): |
| 117 | """3x3 convolution with padding""" |
| 118 | return [ |
| 119 | ( |
| 120 | f"{module_name}_{postfix}/conv", |
| 121 | nn.Conv2d( |
| 122 | in_channels, |
| 123 | out_channels, |
| 124 | kernel_size=kernel_size, |
| 125 | stride=stride, |
| 126 | padding=padding, |
| 127 | groups=groups, |
| 128 | bias=False, |
| 129 | ), |
| 130 | ), |
| 131 | (f"{module_name}_{postfix}/norm", nn.BatchNorm2d(out_channels)), |
| 132 | (f"{module_name}_{postfix}/relu", nn.ReLU(inplace=True)), |
| 133 | ] |
| 134 | |
| 135 | |
| 136 | def conv1x1(in_channels, out_channels, module_name, postfix, stride=1, groups=1, kernel_size=1, padding=0): |