encoder_decoder.py 文件源码

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

项目:lencon 作者: kiyukuta 项目源码 文件源码
def __call__(self, source, target, lengths=None, train=True):
        self.batchsize, self.source_length = source.shape

        state = self.encode(source, train=train)
        state = self.prepare_decoding(state, lengths, train=train)

        y = None
        if target is not None:
            y = chainer.Variable(target, volatile=not train)
            y = F.split_axis(y, y.data.shape[1], 1)

        outs, loss = self.decode(state, y, train=train)
        return outs, loss
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号