test_backends.py 文件源码

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

项目:indigo 作者: mbdriscoll 项目源码 文件源码
def test_blas_dot(backend, n):
    b = backend()
    x = (np.random.rand(n) + 1j * np.random.rand(n))
    y = (np.random.rand(n) + 1j * np.random.rand(n))
    x = np.require(x, dtype=np.dtype('complex64'), requirements='F')
    y = np.require(y, dtype=np.dtype('complex64'), requirements='F')
    x_d = b.copy_array(x)
    y_d = b.copy_array(y)

    y_exp = np.vdot(x, y).real
    y_act = b.dot(x_d, y_d)

    np.testing.assert_allclose(y_exp, y_act, atol=1e-5)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号