def set_inpt(self, inpt, inpt_dropout, mini_batch_size):
# Reshape the input to 2D
self.inpt = inpt.reshape(self.image_shape)
# Do convolution
self.conv_out = conv2d(
input=self.inpt, filters=self.w, filter_shape=self.filter_shape,
input_shape=self.image_shape, border_mode=self.border_mode,
subsample=self.stride)
# Get the feature maps for this layer
self.feature_maps = theano.function([self.inpt], self.conv_out)
# Max pooling
pooled_out = pool.pool_2d(input=self.conv_out, ds=self.poolsize,
ignore_border=True, mode='max')
# Apply bias and activation and set as output
self.output = self.activation_fn(
pooled_out + self.b.dimshuffle('x', 0, 'x', 'x'))
self.output_dropout = self.output # no dropout in convolutional layers
评论列表
文章目录