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

BN error #350

Open
fzh-adham opened this issue Jul 24, 2024 · 8 comments
Open

BN error #350

fzh-adham opened this issue Jul 24, 2024 · 8 comments
Assignees
Labels

Comments

@fzh-adham
Copy link

hi
when I want to generate c files I get this error "the checkpoint file contains 1-dimensional weights for conv1.bn.weight with dimensions (24,). Ensure the BatchNorm layers have been folded."
what is the problem and what is the solution?

@ermanok
Copy link
Contributor

ermanok commented Jul 25, 2024

Hello,

The hardware does not support BatchNorm (BN) layer so if you want to use a BN layer in your model, you have to fuse these layers to the preceding convolution layers (see here). If you enable Quantization Aware Training (QAT) during your model training, the code automatically folds the the batchnorm layers. So if you use qat_checkpoint.pth.tar or qat_best.path.tar, you will not get such an error during the code synthesis. If you want to use post training quantization without QAT, you may run batchnormfuser.py to fold the BN layers to the convolutional layers.

@fzh-adham
Copy link
Author

fzh-adham commented Jul 25, 2024 via email

@ermanok
Copy link
Contributor

ermanok commented Jul 25, 2024

It is a python script that you can run from the command line. The details of the batchnormfuser is here. But we always suggest to use QAT as the direct quantization of a floating model may cause huge accuracy drop.

@fzh-adham
Copy link
Author

fzh-adham commented Jul 25, 2024 via email

@ermanok
Copy link
Contributor

ermanok commented Jul 25, 2024

You need a MAX78000 EvKit to measure and observe the energy consumption. The feather board does not have an energy measurement circuitry.

@fzh-adham
Copy link
Author

thanks for reply
is there any way to calculate energy consumption and power?

@ermanok
Copy link
Contributor

ermanok commented Aug 8, 2024

There is no other straightforward approach to measure the energy consumption.

Copy link

github-actions bot commented Sep 8, 2024

This issue has been marked stale because it has been open for over 30 days with no activity. It will be closed automatically in 10 days unless a comment is added or the "Stale" label is removed.

@github-actions github-actions bot added the Stale label Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants