Skip to content
Snippets Groups Projects
Commit 1b3bb038 authored by Cyril Moineau's avatar Cyril Moineau
Browse files

Fix python unit test.

parent bb485484
No related branches found
No related tags found
3 merge requests!118v0.4.0,!108v0.4.0,!92Export refactor
Pipeline #56714 failed
...@@ -13,28 +13,25 @@ class test_scheduler(unittest.TestCase): ...@@ -13,28 +13,25 @@ class test_scheduler(unittest.TestCase):
pass pass
def test_relu_forward(self): def test_relu_forward(self):
values = np.arange(6) - 3
input_node = aidge_core.Producer(aidge_core.Tensor(values), "Input") t = aidge_core.Tensor(np.arange(6, dtype=np.int32) - 3)
relu = aidge_core.ReLU() relu = aidge_core.ReLU()
gv = aidge_core.GraphView() gv = aidge_core.GraphView()
gv.add(relu) gv.add(relu)
gv.add(input_node)
input_node.add_child(relu)
gv.set_datatype(aidge_core.dtype.int32) gv.set_datatype(aidge_core.dtype.int32)
gv.set_backend("cpu") gv.set_backend("cpu")
scheduler = aidge_core.SequentialScheduler(gv) scheduler = aidge_core.SequentialScheduler(gv)
scheduler.forward() scheduler.forward(data=[t])
out_tensor = relu.get_operator().get_output(0) out_tensor = relu.get_operator().get_output(0)
expected_out = [0,0,0,0,1,2] expected_out = [0,0,0,0,1,2]
for i in range(len(expected_out)): for i in range(len(expected_out)):
self.assertEqual(expected_out[i], out_tensor[i]) self.assertEqual(expected_out[i], out_tensor[i], f"On idx {i}")
def test_sequential_scheduling(self): def test_sequential_scheduling(self):
input_data = np.array([0]).astype(np.float32) input_data = np.array([0]).astype(np.float32)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment