I have implemented a model using the traditional way of implementation. and the code is like this.
def __init__(self):
super(enhance_net_nopool, self).__init__()
number_f = 32
self.relu = nn.ReLU(inplace=True)
self.e_conv1 = nn.Conv2d(number_f, number_f, 3, 1, 1, bias=True)
self.e_conv2 = nn.Conv2d(number_f, number_f, 3, 1, 1, bias=True)
self.e_conv3 = nn.Conv2d(number_f, number_f, 3, 1, 1, bias=True)
def forward(self, x):
x1 = self.relu(self.e_conv1(x))
x2 = self.relu(self.e_conv2(x1))
x3 = self.relu(self.e_conv3(x2))
I need to know is it possible to rewrite that code using
seq_layers=nn.Sequential(*layers)
this *layers.
If it's implemented like this.
self.conv_block = [
relu = nn.ReLU(inplace=True)
conv = nn.Conv2d(number_f, number_f, 3, 1, 1, bias=True)
]
are they the same?