Skip to content

Propagate correct shape for Flatten layer

Javier Duarte requested to merge github/fork/vloncar/multi_dense_fix into master

Created by: vloncar

The recent addition of supporting doing Dense over multi-dimensional tensors (#366) introduced an issue with the output shape of Flatten layer being ignored. Since Flatten is skipped, the optimizer would check for the preceding layer's output which can be the layer before Flatten and replace Dense with 1x1 Conv.

This is fixed by properly handling Flatten as a Reshape. This allows the optimzer to properly handle the shapes and Reshape is just a placeholder that has no impact on HLS.

Test case.

Side note: this leaves Dropout as the only skipped layer. We might as well parse it and all other regularization layers properly into HLSModel and remove them in the nop optimizer where we have better ways of handling graph transformations.

Merge request reports

Loading