Skip to content

Commit 75b95f4

Browse files
committed
Regression test for recursive behaviour in ndarrays_to_tensors()
1 parent dd8fdf1 commit 75b95f4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

torch_np/tests/test_helpers.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import torch
2+
3+
import torch_np as tnp
4+
from torch_np import _helpers
5+
6+
7+
def test_ndarrays_to_tensors():
8+
out = _helpers.ndarrays_to_tensors(((tnp.asarray(42), 7), 3))
9+
assert len(out) == 2
10+
assert isinstance(out[0], tuple) and len(out[0]) == 2
11+
assert isinstance(out[0][0], torch.Tensor)

0 commit comments

Comments
 (0)