def output_func(self, input):
# P(Y|X) = softmax(W.X + b)
q, a = input[0], input[1]
# dot = T.batched_dot(q, T.dot(a, self.W.T))
dot = T.batched_dot(q, T.dot(a, self.W))
self.p_y_given_x = T.nnet.softmax(dot + self.b.dimshuffle('x', 0))
self.prob = self.p_y_given_x[:, -1]
self.y_pred = T.argmax(self.p_y_given_x, axis=1)
return self.y_pred
评论列表
文章目录