def forward(self, x):
"""
Compute the forward pass of the composite transformation H(x),
where x is the concatenation of the current and all preceding
feature maps.
"""
if self.bottleneck:
out = self.conv1(F.relu(self.bn1(x)))
if self.p > 0:
out = F.dropout(out, p=self.p, training=self.training)
out = self.conv2(F.relu(self.bn2(out)))
if self.p > 0:
out = F.dropout(out, p=self.p, training=self.training)
else:
out = self.conv2(F.relu(self.bn2(x)))
if self.p > 0:
out = F.dropout(out, p=self.p, training=self.training)
return torch.cat((x, out), 1)
评论列表
文章目录