Hello!
I am working with the hls4ml library and have a sequential model which does not compile when adding in a Global Average Pooling 1D layer. The model does compile and completes synthesis successfully without the Global Average Pooling 1D layer, but I would like to be able to add in the Global Average Pooling 1D layer at the end of my model. The error I receive is listed below, and I appreciate any help you can provide in fixing this error.

Best,
Kevin
Kevin J. Key
Radar & EW Systems Development
The Johns Hopkins University Applied Physics Laboratory
11100 Johns Hopkins Road
Laurel, MD 20723
--
You received this message because you are subscribed to the Google Groups "hls4ml help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hls4mlhelp+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hls4mlhelp/73a018cc180249e88ad3cc494ef5e217%40jhuapl.edu.
Hi Javier,
Thank you for getting back to me, I appreciate it! Attached is a .txt file with a simple python script which will reproduce the error. I also pasted the code below. Thanks for any help you can give!
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Activation, BatchNormalization, Conv1D, Conv2D, Dropout, GlobalAveragePooling2D, GlobalAveragePooling1D, MaxPooling1D, GlobalMaxPooling1D
from tensorflow.keras.optimizers import Adam
in_shape = 32
out_shape = 4
model = Sequential()
model.add(Conv1D(filters=4, kernel_size=2, padding='same', input_shape=(in_shape, 2)))
model.add(Conv1D(filters=8, kernel_size=2, padding='same'))
model.add(Conv1D(filters=out_shape, kernel_size=2, padding='same'))
model.add(GlobalAveragePooling1D())
adam = Adam(lr=0.0001)
model.compile(optimizer=adam, loss=['categorical_crossentropy'], metrics=['accuracy'])
model.summary()
# Make an hls4ml config & model
import hls4ml
import plotting
config = hls4ml.utils.config_from_keras_model(model, granularity='name')
plotting.print_dict(config)
# Make Model
hls_model = hls4ml.converters.convert_from_keras_model(model,
hls_config=config,
io_type='io_stream',
output_dir='hls4ml_help',
fpga_part='xcvu9p-flgb2104-2-i')
hls4ml.utils.plot_model(hls_model, show_shapes=True, show_precision=True, to_file='model_plot.png')
# Compile and predict
hls_model.compile()
# Synthesize
hls_model.build(csim=False)
# Reports
hls4ml.report.read_vivado_report('hls4ml_help')
Best,
Kevin
Kevin J. Key
Radar & EW Systems Development
The Johns Hopkins University Applied Physics Laboratory
11100 Johns Hopkins Road
Laurel, MD 20723
From: Javier Duarte <javier.m...@gmail.com>
Sent: Friday, September 10, 2021 11:47 AM
To: hls4m...@googlegroups.com; Key, Kevin J. <Kevi...@jhuapl.edu>
Subject: [EXT] Re: [hls4ml.help] hls4ml Global Average Pooling 1D Error
APL external email warning: Verify sender javier.m...@gmail.com before clicking links or attachments |
Hi Javier,
Hope you’re doing well! I wanted to reach out and make sure you received my message below with the script to reproduce the error, thanks!
Best,
Kevin
Kevin J. Key
Radar & EW Systems Development
The Johns Hopkins University Applied Physics Laboratory
11100 Johns Hopkins Road
Laurel, MD 20723
Best,
Kevin
Kevin J. Key
Radar & EW Systems Development
The Johns Hopkins University Applied Physics Laboratory
11100 Johns Hopkins Road
Laurel, MD 20723
From: Javier Duarte <javier.m...@gmail.com>
Sent: Friday, September 10, 2021 11:47 AM
To: hls4m...@googlegroups.com; Key, Kevin J. <Kevi...@jhuapl.edu>
Subject: [EXT] Re: [hls4ml.help] hls4ml Global Average Pooling 1D Error
|
APL external email warning: Verify sender javier.m...@gmail.com before clicking links or attachments |
Dear Kevin,