vgg.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:neural_style_synthesizer 作者: dwango 项目源码 文件源码
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]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号