HI
I just want to know while creating the Inception Network “BasicConv2d” why author implemented with forward block inside class BasicConv2d why cant’t we use just a Function as defined below named def conv3x3??
Is there any special need to define class BasicConv2d(nn.Module) instead of def conv3x3.
class BasicConv2d(nn.Module):
def __init__(self, in_channels, out_channels, **kwargs): super(BasicConv2d, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, bias=False, **kwargs) self.bn = nn.BatchNorm2d(out_channels, eps=0.001) def forward(self, x): x = self.conv(x) x = self.bn(x) return F.relu(x, inplace=True)
def conv3x3(in_planes, out_planes,kernel_size,**kwargs):
“”“3x3 convolution with padding”“”
return nn.Conv2d(in_planes, out_planes, kernel_size, **kwargs)