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

Add docstring + small clean.

parent 0698a5f0
No related branches found
No related tags found
1 merge request!24Add unit test
Pipeline #69286 passed
......@@ -33,7 +33,7 @@ def initFiller(model):
pass
class test_export(unittest.TestCase):
class test_operator_export(unittest.TestCase):
def setUp(self):
# TODO change seed at each test ?
......@@ -44,6 +44,17 @@ class test_export(unittest.TestCase):
pass
def unit_test_export(self, graph_view, op_name, in_dims):
"""
TODO:
* Handle multiple dataformat
* Handle multiple datatype (currently only float32)
Here are the following steps of this test:
1- Generate random inputs
2- Forward random inputs to the graph
3- Generate Cpp export with a main that compare the result of the inference with the result obtained at step 3.
4- Retrieve standard output and using regex to now if the results are the same
"""
graph_view.compile("cpu", aidge_core.dtype.float32, dims=in_dims)
scheduler = aidge_core.SequentialScheduler(graph_view)
......@@ -91,7 +102,8 @@ class test_export(unittest.TestCase):
def test_export_FC_flatten_in(self):
print("FC flatten in")
"""Test exporting a FC operator with a flattened input.
"""
model = aidge_core.sequential([
aidge_core.FC(in_channels=6, out_channels=6, name="InputNode")
])
......@@ -100,19 +112,22 @@ class test_export(unittest.TestCase):
self.unit_test_export(model, "FC_flat", [[1, 6, 1, 1]])
def test_export_FC_image_in(self):
print("FC image in")
"""Test exporting a FC operator with a HWC input.
"""
model = aidge_core.sequential([
aidge_core.FC(in_channels=12, out_channels=6, name="InputNode")
])
initFiller(model)
self.unit_test_export(model, "FC_img", [[1, 3, 2, 2]])
# def test_export_Conv(self):
# model = aidge_core.sequential([
# aidge_core.Conv2D(1, 1, [3, 3], name="InputNode")
# ])
# initFiller(model)
# self.assertTrue(unit_test_export(model, "Conv", [[1, 1, 9, 9]]))
@unittest.skip("Currently this test is failing")
def test_export_Conv(self):
model = aidge_core.sequential([
aidge_core.Conv2D(1, 1, [3, 3], name="InputNode")
])
initFiller(model)
self.unit_test_export(model, "Conv", [[1, 1, 9, 9]])
if __name__ == '__main__':
unittest.main()
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