attenders.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:lencon 作者: kiyukuta 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号