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
is BatchNorm binarized? #714
Comments
Hi @emiliopaolini, The model summary should show the batchnormalization parameters as 32-bit, they are not binarized. When the model is converted to a tflite file, then the batchnormalization layer can be fused with the convolution layer, but internally those batchnorm parameters are still 32-bit. |
Okay i understand. So for example, if i would like to fuse the conv layer and the batch norm and thus removing the batch normalization layer, do you think is it possible? I know that it can be done when the network is not quantized (https://github.com/yaysummeriscoming/Merge_Batch_Norm/blob/master/Remove%20BN%20Transform.pdf). Does the same apply to quantized neural networks? Thank you very much! |
Yes that is possible, TFLite supports this. If the network is not quantized, the batchnormalization values will be fused into the weight matrix and the bias vector. |
So, in order to understand: can i apply the same equations that are applied to the non-quantized case? And then inference is still performed using binary fused parameters right? |
For float or int8 convolutions, the batchnorm coefficients can be fused into the weight matrix. So in terms of the equations in your PDF: |
Hi everyone, i have a simple question: if i look at the summary of every model in larq, it looks like that computation for batch normalization has been binarized. I would like to know how this is done. If it adopts the same strategy as convolution/dense layer or if i am wrong and batch normalization is not binarized at all. Thank you very much!
The text was updated successfully, but these errors were encountered: