def __call__(self, input):
s, f = self.input_shape, self.filter_shape
hzeros = T.basic.zeros((s[0], s[1], (f[2]-1)//2, s[3]), dtype=theano.config.floatX)
vzeros = T.basic.zeros((s[0], s[1], s[2] + (f[2]-1), (f[3]-1)//2), dtype=theano.config.floatX)
input = T.concatenate([hzeros, input, hzeros], axis=2)
input = T.concatenate([vzeros, input, vzeros], axis=3)
input = conv.conv2d(
input=input,
filters=self.W,
border_mode='valid')
return input + self.b.dimshuffle('x', 0, 'x', 'x')
评论列表
文章目录