helpingMethods.py 文件源码

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

项目:CS-LMM 作者: HaohanWang 项目源码 文件源码
def matrixMult(A, B):
    try:
        linalg.blas
    except AttributeError:
        return np.dot(A, B)

    if not A.flags['F_CONTIGUOUS']:
        AA = A.T
        transA = True
    else:
        AA = A
        transA = False

    if not B.flags['F_CONTIGUOUS']:
        BB = B.T
        transB = True
    else:
        BB = B
        transB = False

    return linalg.blas.dgemm(alpha=1., a=AA, b=BB, trans_a=transA, trans_b=transB)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号