def feature_map_activations(self, x):
"""Forward pass through the convolutional layers of the VGG returning
all of its intermediate feature map activations."""
hs = []
pre_pooling_sizes = []
h = x
for conv_block, mp in zip(self.conv_blocks, self.mps):
for conv in conv_block:
h = F.relu(conv(h))
pre_pooling_sizes.append(h.data.shape[2:])
# Disable cuDNN, else pooling indices will not be stored
with chainer.using_config('use_cudnn', 'never'):
h = mp.apply((h,))[0]
hs.append(h)
return hs, pre_pooling_sizes
评论列表
文章目录