Skip to content

Commit

Permalink
Simplify table type names in softmax tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vloncar committed Nov 6, 2023
1 parent c7aa067 commit 3db1e83
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions test/pytest/test_softmax.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,12 @@ def test_softmax(backend, strategy, generate_data, input_bits, input_shape, tabl
model.add(tf.keras.layers.Activation(input_shape=input_shape, activation='softmax', name='softmax'))
model.compile()

f_type = (
f'ac_fixed<{table_bits},true,AC_RND,AC_SAT>' if backend == 'Quartus' else f'ap_fixed<{table_bits},AP_RND,AP_SAT>'
)
table_type = f'fixed<{table_bits}, RND, SAT>'

cfg = hls4ml.utils.config_from_keras_model(model, granularity='name')
cfg['LayerName']['softmax']['Strategy'] = strategy
cfg['LayerName']['softmax']['inv_table_t'] = f_type
cfg['LayerName']['softmax']['exp_table_t'] = f_type
cfg['LayerName']['softmax']['inv_table_t'] = table_type
cfg['LayerName']['softmax']['exp_table_t'] = table_type
cfg['LayerName']['softmax_input']['Precision']['result'] = f'fixed<{input_bits}>'

odir = str(
Expand Down

0 comments on commit 3db1e83

Please sign in to comment.