Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove double transpose for Conv2DBatchnorm #965

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jmitrevs
Copy link
Contributor

@jmitrevs jmitrevs commented Feb 8, 2024

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

  • 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

  • I have read the guidelines for contributing.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • 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 jmitrevs added the bug label Feb 8, 2024
@jmitrevs
Copy link
Contributor Author

jmitrevs commented Feb 9, 2024

This was motivated by issue #957

@jmitrevs
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant