Skip to content

Commit f256146

Browse files
twaclawDiego Sandoval
authored and
Diego Sandoval
committed
Refactor tests for Eye Op in PyTorch
1 parent 5a9d915 commit f256146

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
@@ -282,13 +282,13 @@ def test_eye():
282282
M = scalar("M", dtype="int64")
283283
k = scalar("k", dtype="int64")
284284

285-
out = eye(N, M, k, dtype="int16")
285+
out = eye(N, M, k, dtype="float32")
286286

287287
trange = range(1, 6)
288+
289+
fn = function([N, M, k], out, mode=pytorch_mode)
290+
288291
for _N in trange:
289292
for _M in trange:
290293
for _k in list(range(_M + 2)) + [-x for x in range(1, _N + 2)]:
291-
compare_pytorch_and_py(
292-
FunctionGraph([N, M, k], [out]),
293-
[np.array(_N), np.array(_M), np.array(_k)],
294-
)
294+
np.testing.assert_array_equal(fn(_N, _M, _k), np.eye(_N, _M, _k))

0 commit comments

Comments
 (0)