def test_cputensor_dot():
Y = ng.make_axis(length=2)
M = ng.make_axis(length=1)
N = ng.make_axis(length=3)
np_a = np.array([[1, 2, 3]], dtype=np.float32)
np_b = np.array([[1, 2], [2, 3], [3, 4]], dtype=np.float32)
np_c = np.dot(np_a, np_b)
a = ng.constant(np_a, [M, N]).named('a')
b = ng.constant(np_b, [N, Y]).named('b')
c = ng.dot(a, b)
with executor(c) as ex:
result = ex()
assert np.array_equal(result, np_c)
评论列表
文章目录