Skip to content

Commit 4b4b5a0

Browse files
jmitrevsvloncar
authored andcommitted
Fix docstring text, increase default precision for sensitive tests
1 parent 07cc9c7 commit 4b4b5a0

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

test/pytest/test_keras_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ def test_depthwise2d(backend, io_type):
330330
@pytest.mark.parametrize('io_type', ['io_stream'])
331331
def test_depthwise1d(backend, io_type):
332332
'''
333-
Test proper handling of QConv2DBatchnorm.
333+
Test proper handling of DepthwiseConv1D.
334334
'''
335335
X = np.random.rand(10, 32, 3)
336336
X = np.round(X * 2**10) * 2**-10 # make it an exact ap_fixed<16,6>

test/pytest/test_qkeras.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ def test_qconv2dbn(randX_100_8_8_1, backend, io_type):
388388
)
389389
model.compile()
390390

391-
config = hls4ml.utils.config_from_keras_model(model, granularity='name')
391+
config = hls4ml.utils.config_from_keras_model(model, granularity='name', default_precision='fixed<24,8>')
392392
output_dir = str(test_root_path / f'hls4mlprj_qkeras_qconv2dbn_{backend}_{io_type}')
393393
hls_model = hls4ml.converters.convert_from_keras_model(
394394
model, hls_config=config, output_dir=output_dir, backend=backend, io_type=io_type
@@ -412,7 +412,7 @@ def randX_10_32_32_3():
412412
@pytest.mark.parametrize('io_type', ['io_stream'])
413413
def test_qdepthwiseconv2d(randX_10_32_32_3, backend, io_type):
414414
'''
415-
Test proper handling of QConv2DBatchnorm.
415+
Test proper handling of QDepthwiseConv2D.
416416
'''
417417
X = randX_10_32_32_3
418418
X = np.round(X * 2**10) * 2**-10 # make it an exact ap_fixed<16,6>
@@ -422,15 +422,14 @@ def test_qdepthwiseconv2d(randX_10_32_32_3, backend, io_type):
422422
kernel_size=(3, 3),
423423
input_shape=(32, 32, 3),
424424
depthwise_quantizer='quantized_bits(6, 0, alpha=1)',
425-
depthwise_initializer='ones',
426425
bias_quantizer='quantized_bits(4, 0, alpha=1)',
427-
bias_initializer='zeros',
426+
bias_initializer='he_normal',
428427
activation='quantized_relu(3, 0)',
429428
)
430429
)
431430
model.compile()
432431

433-
config = hls4ml.utils.config_from_keras_model(model, granularity='name')
432+
config = hls4ml.utils.config_from_keras_model(model, granularity='name', default_precision='fixed<24,8>')
434433
output_dir = str(test_root_path / f'hls4mlprj_qkeras_qdepthwiseconv2d_{backend}_{io_type}')
435434
hls_model = hls4ml.converters.convert_from_keras_model(
436435
model, hls_config=config, output_dir=output_dir, backend=backend, io_type=io_type

0 commit comments

Comments
 (0)