We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9187dac commit 3c3478fCopy full SHA for 3c3478f
tests/unit_tests/test_nodes.py
@@ -2,7 +2,7 @@
2
from opto.trace import node
3
from opto.trace import operators as ops
4
from opto.trace.utils import contain
5
-
+import numpy as np
6
7
# Sum of str
8
x = node("NodeX")
@@ -151,4 +151,11 @@ def fun(x):
151
assert x.description == "[ParameterNode] x"
152
153
x = node(1, trainable=True)
154
-assert x.description == "[ParameterNode] This is a ParameterNode in a computational graph."
+assert x.description == "[ParameterNode] This is a ParameterNode in a computational graph."
155
+
156
157
+# Test iterating numpy array
158
+x = node(np.array([1, 2, 3]))
159
+for i, v in enumerate(x):
160
+ assert isinstance(v, type(x))
161
+ assert v.data == x.data[i]
0 commit comments