Comments (4)
Yes, in the latest version of PyTorch, this is computed by sqrt(var + eps)
.
Back in the days when I was developing this package, I was trying out different combinations of possible implementations to match the behavior (not only forward, but also backward...) So using clamp
was the final decision...
It is worth noting that, because of the different ways of computing the gradient (in pytorch, BatchNorm is a fused operator), and also numerical precision issues, neither of these two implementations will perfectly match the pytorch BatchNorm (especially for the backward pass).
It might be a better idea to change it to sqrt(var+eps)
as it at least matches the forward pass better... But due to all these historical issues and the backward compatibility, I don't think I should change the behavior of this module.
I just added a new option for this module so that users can change this default behavior:
import sync_batchnorm
sync_batchnorm.set_sbn_eps_mode('clamp')
sync_batchnorm.set_sbn_eps_mode('plus')
from synchronized-batchnorm-pytorch.
thanks very much for helping! I just checkd the forward pass. But in my knowledge, once forward pass is built, the backward pass is determined. I don't quite understand why there are still some differences in backward pass.
from synchronized-batchnorm-pytorch.
The built-in BatchNorm fuses all backward operations in a single function. Theoretically, the output should be the same as following the computation graph. However, in practice, they are different because of numerical precision issues.
from synchronized-batchnorm-pytorch.
Thanks for guiding me!
from synchronized-batchnorm-pytorch.
Related Issues (20)
- test gap between training and test HOT 3
- Is this a bug that channel between input tensor and sync batchnorm are mismatch the code still run successful? HOT 2
- How to cite this repo in bib?
- How to use it when testing HOT 1
- RuntimeError with convert_model - "found one of them on device: cpu" HOT 2
- Thinking about 'sync_batchnorm.batchnorm.convert_model(module)'.. HOT 1
- Wired things, module must have its parameters and buffers on device cuda:0 (device_ids[0]) but found one of them on device: cpu HOT 1
- Question on `sqrt(max(var, eps))` HOT 2
- module问题
- Training cannot start HOT 7
- Training cannot start
- batchnor while using distributed dataparallel HOT 1
- Train Stucked HOT 4
- raining couldn 't start HOT 2
- Training stuck with multiple call of forward function HOT 7
- Where is "track_running_stats" implementation code? HOT 1
- how to export with onnx
- .
- spam
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from synchronized-batchnorm-pytorch.