rmn.py 文件源码

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

项目:rmn 作者: orhanf 项目源码 文件源码
def pred_probs(self, stream, f_log_probs, prepare_data, verbose=True):

        options = self.options
        probs = []
        n_done = 0

        for x in stream:
            n_done += len(x)

            x, x_mask = prepare_data(x, n_words=options['n_words'])

            pprobs = f_log_probs(x, x_mask)
            for pp in pprobs:
                probs.append(pp)

            if numpy.isnan(numpy.mean(probs)):
                ipdb.set_trace()

            if verbose:
                print >>sys.stderr, '%d samples computed' % (n_done)

        return numpy.array(probs)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号