def eval(self, inp):
#input = self.pad(inp.eval())
results= theano.tensor.nnet.conv2d(input, self.W, border_mode='full' )
biased = results + self.b.dimshuffle('x', 0, 'x', 'x')
result = theano.tensor.nnet.sigmoid(biased)
return result
#test = CNNlayer((1,1,4,4), (1,1,3,3))
#inp = np.array([[0.0,0,0,0],[0,1,0,0], [0,0,0,0], [0,0,0,0]])
#weight = np.array([[1,.2, 0],[.4,.5, 0], [0,0,0]])
#test.setW(weight)
#weight_2 = np.array([list(weight[i][::-1]) for i in range(len(weight))])
#weight_3 = weight_2[::-1]
#print(inp)
#print(( weight_3))
#print("their", conv.conv2d(inp, weight).eval())
评论列表
文章目录