Xilinx / finn-hlslib

Vitis HLS Library for FINN

Home Page:https://xilinx.github.io/finn/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conv1D support

aspaul20 opened this issue · comments

Hi, I wanted to ask if 1D convolutions are supported in FINN-hlslib. If not,

  1. Could we treat the 1D data as "images" with tricks like padding etc. to get it to work with the existing layer?
  2. Are there are any resources that will help me get started with a custom implementation of Conv1D?
    Thanks.

Hi, Conv1D is supported by combining a 1D variant of the ConvolutionInputGenerator (slidingwindow.h) and a normal MVAU (Matrix_Vector_Activate_Batch).

If you plan on using the FINN compiler: You can refer to this FINN-example to see the build-flow for a 1D CNN:
https://github.com/Xilinx/finn-examples/tree/main/build/vgg10-radioml

Most importantly, you will need to apply the Change3DTo4DTensors() transformation (https://github.com/Xilinx/finn-examples/blob/main/build/vgg10-radioml/custom_steps.py#L37) early on, since FINN works with 4D (NHWC) tensors internally, even for feature maps with only 1 spatial dimension.

Thanks for replying. I am not planning to use the compiler, I will use the library to implement the model.

Is this the variant you're referring to?

Also, other than the ConvolutionInputGenerator, what else would have to be changed in the standard convlayer?