diff --git a/tests/max-pool-model.onnx b/tests/max-pool-model.onnx new file mode 100644 index 0000000000000000000000000000000000000000..e3b60d9793f1540ad9e5f829a132e73141b1cc09 --- /dev/null +++ b/tests/max-pool-model.onnx @@ -0,0 +1,21 @@ +finn-hls-onnx-model:ΓΈ +p +inout"StreamingMaxPool* +ImgDim * +NumChannels * +PoolDim * +backend"fpgadataflow :finnmax_pool_graphZ +in + + + +b +out + + + +r +in + finn_datatypeBIPOLARr +out + finn_datatypeBIPOLARB \ No newline at end of file diff --git a/tests/test_layer_streaming_maxpool.py b/tests/test_layer_streaming_maxpool.py new file mode 100644 index 0000000000000000000000000000000000000000..70557ca7802d57fbf2f6dd5e1ce013dee979800c --- /dev/null +++ b/tests/test_layer_streaming_maxpool.py @@ -0,0 +1,35 @@ +# import onnx +from onnx import TensorProto, helper + +from finn.core.datatype import DataType +from finn.core.modelwrapper import ModelWrapper + + +def test_layer_streaming_maxpool(): + inp = helper.make_tensor_value_info("in", TensorProto.FLOAT, [2, 4, 4]) + outp = helper.make_tensor_value_info("out", TensorProto.FLOAT, [2, 2, 2]) + + MaxPool_node = helper.make_node( + "StreamingMaxPool", + ["in"], + ["out"], + domain="finn", + backend="fpgadataflow", + ImgDim=4, + PoolDim=2, + NumChannels=2, + ) + + graph = helper.make_graph( + nodes=[MaxPool_node], name="max_pool_graph", inputs=[inp], outputs=[outp], + ) + model = helper.make_model(graph, producer_name="finn-hls-onnx-model") + model = ModelWrapper(model) + + # set the tensor datatypes (in this case: all to bipolar) + for tensor in graph.input: + model.set_tensor_datatype(tensor.name, DataType["BIPOLAR"]) + for tensor in graph.output: + model.set_tensor_datatype(tensor.name, DataType["BIPOLAR"]) + + # onnx.save(model.model, "max-pool-model.onnx")