-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Wrong model update for BatchNorm for some specific synthax #123
Comments
Really not sure if #2122 might be related (considering BatchNorm is also the operator causing the issue) |
Haven't had a chance to look. My guess is that somehow the mutation of the BatchNorm struct is lost by Optimisers. Would be interesting to know if FluxML/Flux.jl#2127 changes this, as it mutates the tracking arrays directly instead. |
Add a point. I use the latest version of Flux and Optimisers and it seems that this bug was fixed. |
We should add a test to make sure we don't have regressions |
I see the related test was added in Flux. Does Optimiser need a test about |
Package Version
v0.2.13
Julia Version
1.8.2
OS / Environment
Windows
Describe the bug
If using the
opts, m = Optimisers.update!(opts, m, grads)
within a loop with more than 1 iteration that doesn't return the modelm
when complete, the model is improperly updated.Steps to Reproduce
Defining a minimal custom model that contains a BatchNorm, as well a toy data and mse loss:
2 variations of a training loop (with and without opts, m assignements):
Expected Results
It would be expected that each loop result in identical models. However, it's not the case:
Note that if the loop had only a single iteration (
for i in = 1:1
), the models would then be identical.Also, if the model is returned following the loop and assigned, then the 2 loops also behave the same:
The
0.10831509f0
is the same as the one obtained usingfit_2!
.Observed Results
none
Relevant log output
none
The text was updated successfully, but these errors were encountered: