def __call__(self, p, train=True):
attention = self._attend(p)
if self.history is not None:
self.history.append(
chainer.cuda.to_cpu(attention.data[0, :, 0]).tolist())
ret = F.batch_matmul(F.swapaxes(self.source_hiddens, 2, 1), attention)
return F.reshape(ret, (self.batchsize, self.dim_out))
评论列表
文章目录