Linear接在卷积后面,如何得到faltten后的input尺寸?
Created by: lao-xu
使用paddle1.7动态图,Linear接在卷积后面,要输入faltten后的input尺寸,怎么去得到?难道都要人工计算吗?
self.pool2 = Pool2D(pool_size=2, pool_stride=2, pool_type='max')
# 创建第3个卷积层
self.conv3 = Conv2D(num_channels=16, num_filters=120, filter_size=4, act='sigmoid')
# 创建全连接层,第一个全连接层的输出神经元个数为64, 第二个全连接层输出神经元个数为分裂标签的类别数
self.flatten_shape = 120*50*50
self.fc1 = Linear(input_dim=self.flatten_shape, output_dim=64, act='sigmoid')
self.fc2 = Linear(input_dim=64, output_dim=num_classes,act='softmax')