Skip to content

Commit 5241109

Browse files
jmitrevsvloncar
authored andcommitted
remove checks on 'padding' that were missed in previous PR
1 parent 5d0bdb5 commit 5241109

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

test/pytest/test_keras_api.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ def test_conv1d(padds, backend, io_type):
165165
assert list(hls_model.get_layers())[1].attributes['n_chan'] == model.layers[0].input_shape[2]
166166
assert list(hls_model.get_layers())[1].attributes['n_filt'] == model.layers[0].filters
167167
assert list(hls_model.get_layers())[1].attributes['stride_width'] == model.layers[0].strides[0]
168-
assert list(hls_model.get_layers())[1].attributes['padding'] == model.layers[0].padding
169168
assert list(hls_model.get_layers())[1].attributes['data_format'] == model.layers[0].data_format
170169
assert list(hls_model.get_layers())[1].attributes["out_width"] == list(model.layers[0].output_shape)[1]
171170

@@ -235,7 +234,6 @@ def test_conv2d(chans, padds, backend, io_type):
235234
assert list(hls_model.get_layers())[1].attributes['n_filt'] == model.layers[0].filters
236235
assert list(hls_model.get_layers())[1].attributes['stride_width'] == model.layers[0].strides[1]
237236
assert list(hls_model.get_layers())[1].attributes['stride_height'] == model.layers[0].strides[0]
238-
assert list(hls_model.get_layers())[1].attributes['padding'] == model.layers[0].padding
239237
assert list(hls_model.get_layers())[1].attributes['data_format'] == model.layers[0].data_format
240238

241239
if model.layers[0].data_format == 'channels_first':
@@ -392,7 +390,6 @@ def test_pooling(pooling, padds, chans, backend):
392390
assert hls_pool.attributes['stride_width'] == ker_pool.strides[1]
393391
assert hls_pool.attributes['pool_height'] == ker_pool.pool_size[1]
394392
assert hls_pool.attributes['pool_width'] == ker_pool.pool_size[0]
395-
assert hls_pool.attributes['padding'] == ker_pool.padding
396393

397394
if hls_pool.attributes['data_format'] == 'channels_last':
398395
assert hls_pool.attributes['in_height'] == ker_pool.input_shape[1]
@@ -403,7 +400,7 @@ def test_pooling(pooling, padds, chans, backend):
403400
assert hls_pool.attributes['in_width'] == ker_pool.input_shape[3]
404401
assert hls_pool.attributes['n_filt'] == ker_pool.input_shape[1]
405402

406-
if hls_pool.attributes['padding'] == 'same':
403+
if ker_pool.padding == 'same':
407404
# Height
408405
in_height = ker_pool.input_shape[1]
409406
if ker_pool.data_format == 'channels_first':
@@ -434,7 +431,7 @@ def test_pooling(pooling, padds, chans, backend):
434431
assert pad_left == hls_pool.attributes['pad_left']
435432
assert pad_right == hls_pool.attributes['pad_right']
436433

437-
elif hls_pool.attributes['padding'] == 'valid':
434+
elif ker_pool.padding == 'valid':
438435
if hls_pool.attributes['data_format'] == 'channels_first':
439436
in_height = ker_pool.input_shape[2]
440437
in_width = ker_pool.input_shape[3]
@@ -459,12 +456,11 @@ def test_pooling(pooling, padds, chans, backend):
459456
assert hls_pool.attributes['n_filt'] == ker_pool.input_shape[2]
460457
assert hls_pool.attributes['pool_width'] == ker_pool.pool_size[0]
461458
assert hls_pool.attributes['stride_width'] == ker_pool.strides[0]
462-
assert hls_pool.attributes['padding'] == ker_pool.padding
463459

464460
out_same = math.ceil(float(ker_pool.input_shape[1]) / float(ker_pool.strides[0]))
465461
out_valid = math.ceil(float(ker_pool.input_shape[1] - ker_pool.pool_size[0] + 1) / ker_pool.strides[0])
466462

467-
if hls_pool.attributes['padding'] == 'same':
463+
if ker_pool.padding == 'same':
468464
assert hls_pool.attributes['n_out'] == out_same
469465
if ker_pool.input_shape[1] % ker_pool.strides[0] == 0:
470466
pad_along_width = max(ker_pool.pool_size[0] - ker_pool.strides[0], 0)
@@ -473,7 +469,7 @@ def test_pooling(pooling, padds, chans, backend):
473469
assert hls_pool.attributes['pad_left'] == pad_along_width // 2
474470
assert hls_pool.attributes['pad_right'] == pad_along_width - pad_along_width // 2
475471

476-
elif hls_pool.attributes['padding'] == 'valid':
472+
elif ker_pool.padding == 'valid':
477473
assert hls_pool.attributes['n_out'] == out_valid
478474
assert hls_pool.attributes['pad_left'] == 0
479475
assert hls_pool.attributes['pad_right'] == 0

0 commit comments

Comments
 (0)