Replies: 1 comment
-
This should be fairly simple, let me see if I can find a volunteer to implement it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I'd like to suggest support for torch.nn.ConstantPad2d in hls4ml.
This module is a simple and explicit way to apply zero-padding in PyTorch models. It's clean to use, exportable to ONNX without issues, and especially useful in modular or quantized models where padding is applied outside the convolution layer (rather than as padding= in Conv2d).
Currently, when exporting a model using ConstantPad2d, the ONNX graph contains a Pad node with a pads attribute and a constant value (usually 0). However, hls4ml doesn't support Pad yet, even though it already has internal support for ZeroPadding2D (as used by Keras models).
Would it be feasible to map ONNX Pad nodes with constant value 0 to ZeroPadding2D in hls4ml? I believe this would improve support for PyTorch models and allow more flexibility in network architectures.
Thanks for your time!
Beta Was this translation helpful? Give feedback.
All reactions