def __call__(self, xs):
if self.freeze:
self.embed.disable_update()
xs = self.embed(xs)
batchsize, height, width = xs.shape
xs = F.reshape(xs, (batchsize, 1, height, width))
conv3_xs = self.conv3(xs)
conv4_xs = self.conv4(xs)
conv5_xs = self.conv5(xs)
h1 = F.max_pooling_2d(F.relu(conv3_xs), conv3_xs.shape[2])
h2 = F.max_pooling_2d(F.relu(conv4_xs), conv4_xs.shape[2])
h3 = F.max_pooling_2d(F.relu(conv5_xs), conv5_xs.shape[2])
concat_layer = F.concat([h1, h2, h3], axis=1)
with chainer.using_config('train', True):
y = self.l1(F.dropout(F.tanh(concat_layer)))
return y
评论列表
文章目录