def step(self, input):
# self.input = input
# convolve input feature maps with filters
# conv_out = t.conv.conv2d(
# input=input,
# filters=self.W,
# filter_shape=filter_shape,
# image_shape=image_shape
# )
conv_out = conv.conv2d(
input=input,
filters=self.W,
filter_shape=self.filter_shape,
image_shape=self.image_shape,
border_mode=self.border_mode
)
# downsample each feature map individually, using maxpooling
pooled_out = downsample.max_pool_2d(
input=conv_out,
ds=self.poolsize,
ignore_border=True,
)
# add the bias term. Since the bias is a vector (1D array), we first
# reshape it to a tensor of shape (1, n_filters, 1, 1). Each bias will
# thus be broadcasted across mini-batches and feature map
# width & height
output = tt.tanh(pooled_out + self.b.dimshuffle('x', 0, 'x', 'x'))
return output
评论列表
文章目录