MCPcopy Create free account
hub / github.com/cactus-compute/cactus / test_view

Method test_view

python/tests/test_graph.py:114–124  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

112class TestGraphTensorOps(unittest.TestCase):
113
114 def test_view(self):
115 g = Graph()
116 a = g.input((2, 3))
117 y = a.view((6,))
118
119 g.set_input(a, np.array([[1, 2, 3], [4, 5, 6]], dtype=np.float16))
120 g.execute()
121
122 out = y.numpy()
123 expected = np.array([1, 2, 3, 4, 5, 6], dtype=np.float16)
124 np.testing.assert_allclose(out, expected, atol=1e-2)
125
126 def test_flatten(self):
127 g = Graph()

Callers

nothing calls this directly

Calls 6

inputMethod · 0.95
set_inputMethod · 0.95
executeMethod · 0.95
GraphClass · 0.90
numpyMethod · 0.80
viewMethod · 0.45

Tested by

no test coverage detected