hls4ml icon indicating copy to clipboard operation
hls4ml copied to clipboard

Remove double transpose for Conv2DBatchnorm

Open jmitrevs opened this issue 1 year ago • 2 comments

Description

In the layers.py Conv2DBatchnorm makes a transpose if it is the resource strategy, but only for Vivado and VivadoAccelerator backends. Note that Conv2DBatchnorm inherits from Conv2D, and Conv2D makes the same transpose in:

https://github.com/fastmachinelearning/hls4ml/blob/main/hls4ml/backends/vivado/passes/resource_strategy.py#L29-L32

I think therefore the transpose is doubly-applied. I am therefore removing the backend-specific transpose in the layers.py, which regardless does not belong there.

Type of change

  • [x] Bug fix (non-breaking change that fixes an issue)

Tests

I assume there's a Conv2DBatchnorm test that will catch this change, but maybe not.

Test Configuration:

Checklist

  • [x] I have read the guidelines for contributing.
  • [x] I have commented my code, particularly in hard-to-understand areas.
  • [x] I have made corresponding changes to the documentation.
  • [x] My changes generate no new warnings.
  • [x] I have installed and run pre-commit on the files I edited or added.
  • [ ] I have added tests that prove my fix is effective or that my feature works.

jmitrevs avatar Feb 08 '24 21:02 jmitrevs

This was motivated by issue #957

jmitrevs avatar Feb 09 '24 22:02 jmitrevs

Conv2DBatchnorm seems buggy in general. We may want a more serious look at it.

jmitrevs avatar Aug 21 '24 15:08 jmitrevs