Description
I have QCNN model( I used qkeras library) and when I setup the below configuration and I got an error.
I updated the last version of hls4ml.
Model:
Layer (type) Output Shape Param
rf_input (InputLayer) [(None, 1024, 2)] 0
q_conv1d (QConv1D) (None, 1024, 64) 640
q_batch_normalization (QBa (None, 1024, 64) 256
tchNormalization)
q_activation (QActivation) (None, 1024, 64) 0
max_pooling1d (MaxPooling1 (None, 512, 64) 0
D)
q_conv1d_1 (QConv1D) (None, 512, 32) 10240
q_batch_normalization_1 (Q (None, 512, 32) 128
BatchNormalization)
q_activation_1 (QActivatio (None, 512, 32) 0
n)
max_pooling1d_1 (MaxPoolin (None, 256, 32) 0
g1D)
q_conv1d_2 (QConv1D) (None, 256, 16) 2560
q_batch_normalization_2 (Q (None, 256, 16) 64
BatchNormalization)
q_activation_2 (QActivatio (None, 256, 16) 0
n)
max_pooling1d_2 (MaxPoolin (None, 128, 16) 0
g1D)
flatten (Flatten) (None, 2048) 0
q_dense (QDense) (None, 128) 262144
dropout (Dropout) (None, 128) 0
q_dense_1 (QDense) (None, 128) 16384
dropout_1 (Dropout) (None, 128) 0
q_dense_2 (QDense) (None, 7) 896
activation (Activation) (None, 7) 0
=================================================================
Total params: 293312 (1.12 MB)
Trainable params: 293088 (1.12 MB)
Non-trainable params: 224 (896.00 Byte)
Here is my hls4ml setup:
hls_config = hls4ml.utils.config_from_keras_model(model, granularity='name')
hls_config['Model']['ReuseFactor']=16
hls_config['Model']['Strategy']='Resources'
for Layer in hls_config['LayerName'].keys():
hls_config['LayerName'][Layer]['Strategy'] = 'Resources'
hls_config['LayerName'][Layer]['ReuseFactor'] = 16
hls_config['LayerName']['softmax']['exp_table_t'] = 'ap_fixed<16,6>'
hls_config['LayerName']['softmax']['inv_table_t'] = 'ap_fixed<16,6>'
hls_config['LayerName']['output_softmax']['Strategy'] = 'Stable'
cfg = hls4ml.converters.create_config(backend='Vivado')
cfg['IOType'] = 'io_stream'
cfg['HLSConfig'] = hls_config
cfg['KerasModel'] = model
cfg['OutputDir'] = 'CNN_16_6'
hls_model = hls4ml.converters.convert_from_keras_model(
model, hls_config=hls_config, output_dir='CNN_16_6', backend='VivadoAccelerator', board='zcu102')
hls_model.compile()