def test_transpose2(x, y, axis1, axis2): perm = (scalar_cast(axis1, u64), scalar_cast(axis2, u64)) xt = transpose(x, perm) yt = transpose(y, perm) d = dot(xt, yt) sm = array_reduce(scalar_add, d, ()) return array_to_scalar(sm)
def test_prim_dot(): a = np.ones((2, 3)) b = np.ones((3, 4)) ref = np.dot(a, b) res = dot(a, b) assert (res == ref).all()
def test_transpose(x, y): xt = transpose(x, (1, 0)) yt = transpose(y, (1, 0)) d = dot(xt, yt) sm = array_reduce(scalar_add, d, ()) return array_to_scalar(sm)
def test_dot(x, y): d = dot(x, y) sm = array_reduce(scalar_add, d, ()) return array_to_scalar(sm)