-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
Fix type-stability for normalization layers #1856
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1856 +/- ##
==========================================
+ Coverage 73.85% 74.06% +0.20%
==========================================
Files 28 28
Lines 1683 1704 +21
==========================================
+ Hits 1243 1262 +19
- Misses 440 442 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do the times look now? More or less the same?
Yes, the times are the same. [ Info: forward
0.000813 seconds (15 allocations: 1.532 MiB)
461.305 μs (15 allocations: 1.53 MiB)
[ Info: grad
1.970701 seconds (7.04 M allocations: 366.512 MiB, 4.10% gc time, 99.81% compilation time)
2.209 ms (634 allocations: 12.28 MiB) |
Magnificent, thanks! P.S.
For any prospective contributors reading this comment, here's a "good first issue" ;) |
This PR fixes type-stability for normalization layers.
This also makes ResNet model type-stable (as well as others).
While there is PR that reworks normalization layers, it is not clear what is the status of it.
@ToucheSir has also suggested that functional part should be moved into NNlib.jl, so I'm not sure if this PR should be accepted in the first place...
But at least we can use it to look at what improvements type-stability can bring in this case...
Also I feel it is not the cleanest solution, as it essentially computes the output typeo::_basetype(typeof(x)){O, N}
.Benchmark:
Before:
After:
PR Checklist