model.py 文件源码

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

项目:DCNMT 作者: SwordYork 项目源码 文件源码
def single_emit(self, target_single_char, batch_size, mask, states=None):
        # Time as first dimension
        # only one batch
        embeddings = self.lookup.apply(target_single_char)
        if states is None:
            states = self.dgru.initial_states(batch_size)
        states_dict = {'states': states[0]}
        for i in range(1, self.dgru_depth):
            states_dict['states' + RECURRENTSTACK_SEPARATOR + str(i)] = states[i]
        gru_out = self.dgru.apply(**merge(self.gru_fork.apply(embeddings, as_dict=True), states_dict,
                                          {'mask': mask, 'iterate': False}))
        return gru_out
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号