preprocess.py 文件源码

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

项目:MatchZoo 作者: faneshion 项目源码 文件源码
def cal_hist(t1_rep, t2_rep, qnum, hist_size):
    #qnum = len(t1_rep)
    mhist = np.zeros((qnum, hist_size), dtype=np.float32)
    mm = t1_rep.dot(np.transpose(t2_rep))
    for (i,j), v in np.ndenumerate(mm):
        if i >= qnum:
            break
        vid = int((v + 1.) / 2. * (hist_size - 1.))
        mhist[i][vid] += 1.
    mhist += 1.
    mhist = np.log10(mhist)
    return mhist.flatten()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号