len_init.py 文件源码

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

项目:lencon 作者: kiyukuta 项目源码 文件源码
def prepare_decoding(self, state, lengths, train=True):
        state = super().prepare_decoding(state, lengths, train=train)

        x = state['x']
        h = state['h']

        c = F.broadcast_to(self.encoder.c0, (self.batchsize, self.dim_hid))
        lengths = lengths.astype(np.float32)
        lengths = lengths.reshape((self.batchsize, 1))
        c = c * lengths
        return {'x': x, 'c': c, 'h': h}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号