Skip to content

Commit c36ac85

Browse files
committed
Refactor tests for Eye Op in PyTorch
1 parent f1d5c2b commit c36ac85

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/link/pytorch/test_basic.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,13 @@ def test_eye():
242242
M = scalar("M", dtype="int64")
243243
k = scalar("k", dtype="int64")
244244

245-
out = eye(N, M, k, dtype="int16")
245+
out = eye(N, M, k, dtype="float32")
246246

247247
trange = range(1, 6)
248+
249+
fn = function([N, M, k], out, mode=pytorch_mode)
250+
248251
for _N in trange:
249252
for _M in trange:
250253
for _k in list(range(_M + 2)) + [-x for x in range(1, _N + 2)]:
251-
compare_pytorch_and_py(
252-
FunctionGraph([N, M, k], [out]),
253-
[np.array(_N), np.array(_M), np.array(_k)],
254-
)
254+
np.testing.assert_array_equal(fn(_N, _M, _k), np.eye(_N, _M, _k))

0 commit comments

Comments
 (0)