fusion.py 文件源码

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

项目:asreader 作者: rkadlec 项目源码 文件源码
def predictions_from_csv(fh, max_length):
    """
    Loads single model predictions from a csv file where lines may differ in length
    :param fh: file handle to the csv file
    :return: list of numpy arrays representing the predictions of individual examples
    """
    preds = list()
    lineN = 0
    for line in fh:
        lineN += 1
        pred_line = numpy.fromstring(line, sep=', ')
        if (args.trim_zeros):
            # If different batch sizes are used for the fused models, the prediction vectors need to be adjusted
            pred_line, max_length = adjust_length(pred_line, lineN, max_length)
        preds.append(pred_line)
    return preds, max_length
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号