def forward_layers(self, x, average_pooling=False):
if average_pooling:
pooling = lambda x: chainer.functions.average_pooling_2d(chainer.functions.relu(x), 2, stride=2)
else:
pooling = lambda x: chainer.functions.max_pooling_2d(chainer.functions.relu(x), 2, stride=2)
y1 = self.model.conv1_2(chainer.functions.relu(self.model.conv1_1(x)))
x1 = pooling(y1)
y2 = self.model.conv2_2(chainer.functions.relu(self.model.conv2_1(x1)))
x2 = pooling(y2)
y3 = self.model.conv3_3(
chainer.functions.relu(self.model.conv3_2(chainer.functions.relu(self.model.conv3_1(x2)))))
x3 = pooling(y3)
y4 = self.model.conv4_3(
chainer.functions.relu(self.model.conv4_2(chainer.functions.relu(self.model.conv4_1(x3)))))
return [y1, y2, y3, y4]
评论列表
文章目录