4141
4242import finn .core .onnx_exec as oxe
4343from finn .transformation .qonnx .convert_qonnx_to_finn import ConvertQONNXtoFINN
44-
45- export_onnx_path = "test_brevitas_relu_act_export.onnx"
44+ from finn .util .basic import make_build_dir
4645
4746
4847@pytest .mark .brevitas_export
@@ -55,7 +54,8 @@ def test_brevitas_act_export_relu(
5554 b_act = QuantReLU (
5655 bit_width = abits ,
5756 )
58- m_path = export_onnx_path
57+ build_dir = make_build_dir (prefix = "test_brevitas_act_export_relu" )
58+ m_path = os .path .join (build_dir , "test_brevitas_relu_act_export.onnx" )
5959 export_qonnx (b_act , torch .randn (ishape ), m_path )
6060 qonnx_cleanup (m_path , out_file = m_path )
6161 model = ModelWrapper (m_path )
@@ -70,7 +70,6 @@ def test_brevitas_act_export_relu(
7070 expected = b_act .forward (inp_tensor ).detach ().numpy ()
7171
7272 assert np .isclose (produced , expected , atol = 1e-3 ).all ()
73- os .remove (export_onnx_path )
7473
7574
7675@pytest .mark .brevitas_export
@@ -88,7 +87,8 @@ def test_brevitas_act_export_relu_channel(
8887 scaling_per_output_channel = True ,
8988 per_channel_broadcastable_shape = (1 , ch , 1 , 1 ),
9089 )
91- m_path = export_onnx_path
90+ build_dir = make_build_dir (prefix = "test_brevitas_act_export_relu_channel" )
91+ m_path = os .path .join (build_dir , "test_brevitas_relu_act_export.onnx" )
9292 export_qonnx (b_act , torch .randn (ishape ), m_path )
9393 qonnx_cleanup (m_path , out_file = m_path )
9494 model = ModelWrapper (m_path )
@@ -103,4 +103,3 @@ def test_brevitas_act_export_relu_channel(
103103 expected = b_act .forward (inp_tensor ).detach ().numpy ()
104104
105105 assert np .isclose (produced , expected , atol = 1e-3 ).all ()
106- os .remove (export_onnx_path )
0 commit comments