From fa1a42841ea8a4e9f3f37196d05da9bacde9a151 Mon Sep 17 00:00:00 2001 From: Jovan Mitrevski Date: Tue, 10 Feb 2026 14:39:00 -0600 Subject: [PATCH 1/4] make test_root_path consistent for all the tests --- test/pytest/test_keras_v3_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/pytest/test_keras_v3_api.py b/test/pytest/test_keras_v3_api.py index 695369312b..fb26988df2 100644 --- a/test/pytest/test_keras_v3_api.py +++ b/test/pytest/test_keras_v3_api.py @@ -26,7 +26,7 @@ import hls4ml -test_root_path = Path('/tmp/tests') +test_root_path = Path(__file__).parent @pytest.mark.parametrize('backend', ['Vivado', 'Vitis', 'Quartus', 'oneAPI', 'Catapult']) From c72faf4150a04bbc19f27e72edbd52372b76170f Mon Sep 17 00:00:00 2001 From: Jovan Mitrevski Date: Tue, 10 Feb 2026 14:45:11 -0600 Subject: [PATCH 2/4] prevent folder name conflicts, make uniform --- test/pytest/test_keras_v3_api.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/pytest/test_keras_v3_api.py b/test/pytest/test_keras_v3_api.py index fb26988df2..576196d4bc 100644 --- a/test/pytest/test_keras_v3_api.py +++ b/test/pytest/test_keras_v3_api.py @@ -57,7 +57,7 @@ def test_dense(backend, io_type): keras_prediction = model.predict(X_input, verbose=0) # type: ignore config = hls4ml.utils.config_from_keras_model(model) - output_dir = str(test_root_path / f'hls4mlprj_keras_api_dense_{backend}_{io_type}') + output_dir = str(test_root_path / f'hls4mlprj_keras_v3_api_dense_{backend}_{io_type}') hls_model = hls4ml.converters.convert_from_keras_model( model, hls_config=config, output_dir=output_dir, backend=backend, io_type=io_type @@ -105,7 +105,7 @@ def test_activations(activation_function, backend, io_type): X_input = np.random.rand(1000, 1) keras_prediction = model.predict(X_input, verbose=0) # type: ignore config = hls4ml.utils.config_from_keras_model(model) - output_dir = str(test_root_path / f'hls4mlprj_keras_api_activations_{activation_function.name}_{backend}_{io_type}') + output_dir = str(test_root_path / f'hls4mlprj_keras_v3_api_activations_{activation_function.name}_{backend}_{io_type}') hls_model = hls4ml.converters.convert_from_keras_model( model, hls_config=config, output_dir=output_dir, backend=backend, io_type=io_type ) @@ -151,7 +151,7 @@ def test_conv1d(padds, backend, io_type): keras_prediction = model.predict(X_input, verbose=0) # type: ignore config = hls4ml.utils.config_from_keras_model(model) - output_dir = str(test_root_path / f'hls4mlprj_keras_api_conv1d_{padds}_{backend}_{io_type}') + output_dir = str(test_root_path / f'hls4mlprj_keras_v3_api_conv1d_{padds}_{backend}_{io_type}') hls_model = hls4ml.converters.convert_from_keras_model( model, hls_config=config, output_dir=output_dir, backend=backend, io_type=io_type ) @@ -228,7 +228,7 @@ def test_conv2d(chans, padds, backend, io_type): keras_prediction = model.predict(X_input) config = hls4ml.utils.config_from_keras_model(model) - output_dir = str(test_root_path / f'hls4ml_project_keras_api_conv2d_{backend}_{chans}_{padds}_{io_type}') + output_dir = str(test_root_path / f'hls4mlprj_keras_v3_api_conv2d_{backend}_{chans}_{padds}_{io_type}') hls_model = hls4ml.converters.convert_from_keras_model( model, hls_config=config, output_dir=output_dir, backend=backend, io_type=io_type ) @@ -311,7 +311,7 @@ def test_depthwise2d(backend, io_type): config = hls4ml.utils.config_from_keras_model( model, granularity='name', default_precision='fixed<32,12>', backend=backend ) - output_dir = str(test_root_path / f'hls4mlprj_keras_api_depthwiseconv2d_{backend}_{io_type}') + output_dir = str(test_root_path / f'hls4mlprj_keras_v3_api_depthwiseconv2d_{backend}_{io_type}') hls_model = hls4ml.converters.convert_from_keras_model( model, hls_config=config, output_dir=output_dir, backend=backend, io_type=io_type ) @@ -336,7 +336,7 @@ def test_depthwise1d(backend, io_type): model.compile() config = hls4ml.utils.config_from_keras_model(model, granularity='name', backend=backend) - output_dir = str(test_root_path / f'hls4mlprj_keras_api_depthwiseconv1d_{backend}_{io_type}') + output_dir = str(test_root_path / f'hls4mlprj_keras_v3_api_depthwiseconv1d_{backend}_{io_type}') hls_model = hls4ml.converters.convert_from_keras_model( model, hls_config=config, output_dir=output_dir, backend=backend, io_type=io_type ) @@ -368,7 +368,7 @@ def test_pooling(pooling, padds, chans, backend): hls_cfg = hls4ml.utils.config_from_keras_model(keras_model) output_dir = str( - test_root_path / f'hls4mlprj_keras_api_pooling_{pooling.__name__}_channels_{chans}_padds_{padds}_backend_{backend}' + test_root_path / f'hls4mlprj_keras_v3_api_pooling_{pooling.__name__}_channels_{chans}_padds_{padds}_backend_{backend}' ) hls_model = hls4ml.converters.convert_from_keras_model( keras_model, hls_config=hls_cfg, output_dir=output_dir, backend=backend @@ -497,7 +497,7 @@ def test_reused_layer(backend, io_type): _ = model([inp1, inp1]) hls_config = {'Model': {'Precision': 'ap_fixed<32,8>', 'ReuseFactor': 1}} - output_dir = str(test_root_path / f'hls4mlprj_keras_api_conv1d_{backend}_{io_type}') + output_dir = str(test_root_path / f'hls4mlprj_keras_v3_api_conv1d_{backend}_{io_type}') model_hls = hls4ml.converters.convert_from_keras_model( model, backend=backend, io_type=io_type, hls_config=hls_config, output_dir=output_dir From ea9948a2684986cff48cbf113260aa27496d1f07 Mon Sep 17 00:00:00 2001 From: Jovan Mitrevski Date: Tue, 10 Feb 2026 15:01:21 -0600 Subject: [PATCH 3/4] pre-commit fixes --- test/pytest/test_keras_v3_api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/pytest/test_keras_v3_api.py b/test/pytest/test_keras_v3_api.py index 576196d4bc..a0e23cf3e4 100644 --- a/test/pytest/test_keras_v3_api.py +++ b/test/pytest/test_keras_v3_api.py @@ -368,7 +368,8 @@ def test_pooling(pooling, padds, chans, backend): hls_cfg = hls4ml.utils.config_from_keras_model(keras_model) output_dir = str( - test_root_path / f'hls4mlprj_keras_v3_api_pooling_{pooling.__name__}_channels_{chans}_padds_{padds}_backend_{backend}' + test_root_path + / f'hls4mlprj_keras_v3_api_pooling_{pooling.__name__}_channels_{chans}_padds_{padds}_backend_{backend}' ) hls_model = hls4ml.converters.convert_from_keras_model( keras_model, hls_config=hls_cfg, output_dir=output_dir, backend=backend From c022f9c6735117242c2403549286f66f60434b97 Mon Sep 17 00:00:00 2001 From: Jovan Mitrevski Date: Tue, 10 Feb 2026 15:27:28 -0600 Subject: [PATCH 4/4] make sure the test output directories are unique --- test/pytest/test_keras_v3_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/pytest/test_keras_v3_api.py b/test/pytest/test_keras_v3_api.py index a0e23cf3e4..782f964dfa 100644 --- a/test/pytest/test_keras_v3_api.py +++ b/test/pytest/test_keras_v3_api.py @@ -498,7 +498,7 @@ def test_reused_layer(backend, io_type): _ = model([inp1, inp1]) hls_config = {'Model': {'Precision': 'ap_fixed<32,8>', 'ReuseFactor': 1}} - output_dir = str(test_root_path / f'hls4mlprj_keras_v3_api_conv1d_{backend}_{io_type}') + output_dir = str(test_root_path / f'hls4mlprj_keras_v3_api_reused_{backend}_{io_type}') model_hls = hls4ml.converters.convert_from_keras_model( model, backend=backend, io_type=io_type, hls_config=hls_config, output_dir=output_dir