Skip to content

Commit f8e0416

Browse files
committed
Quartus Embedding PyTest
1 parent 0b8d55a commit f8e0416

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

test/pytest/test_embed.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,31 @@ def keras_model():
2020
return model
2121

2222
@pytest.fixture
23-
@pytest.mark.parametrize('io_type', ['io_parallel',
24-
'io_stream'])
25-
def hls_model(keras_model, io_type):
23+
@pytest.mark.parametrize('backend, io_type', [
24+
('Vivado', 'io_parallel'),
25+
('Vivado', 'io_stream'),
26+
('Quartus', 'io_parallel')
27+
])
28+
def hls_model(keras_model, backend, io_type):
2629
hls_config = hls4ml.utils.config_from_keras_model(keras_model,
2730
default_precision='ap_fixed<16,6>',
2831
granularity='name')
2932
hls_config['LayerName']['embedding_input']['Precision']['result'] = 'ap_uint<4>'
30-
out_dir = str(test_root_path / 'hls4mlprj_embed_{}').format(io_type)
33+
out_dir = str(test_root_path / 'hls4mlprj_embed_{}_{}').format(backend, io_type)
3134
hls_model = hls4ml.converters.convert_from_keras_model(keras_model,
35+
backend=backend,
3236
hls_config=hls_config,
3337
io_type=io_type,
3438
output_dir=out_dir)
3539

3640
hls_model.compile()
3741
return hls_model
3842

39-
@pytest.mark.parametrize('io_type', ['io_parallel',
40-
'io_stream'])
43+
@pytest.mark.parametrize('backend, io_type', [
44+
('Vivado', 'io_parallel'),
45+
('Vivado', 'io_stream'),
46+
('Quartus', 'io_parallel')
47+
])
4148
def test_embedding_accuracy(data, keras_model, hls_model):
4249
X = data
4350
model = keras_model

0 commit comments

Comments
 (0)