-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
remove DepthwiseConv type in favor of Conv #1921
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1921 +/- ##
==========================================
+ Coverage 86.43% 86.66% +0.22%
==========================================
Files 18 18
Lines 1430 1417 -13
==========================================
- Hits 1236 1228 -8
+ Misses 194 189 -5
Continue to review full report at Codecov.
|
ready for review/merge |
Should what's left move to deprecations.jl too? |
I think it is good to have a convenience constructor like that, helps you understand what a depthwise convolution is |
Would you mind running some microbenchmarks on CPU pre- and post-PR? If there's basically no difference between the two, let's merge asap :) |
Xref FluxML/NNlib.jl#395 perhaps. The present code has 3 layers of multi-threading, not sure how carefully it was ever benchmarked. |
Performance here seems slightly better. We should remove the specialized This PRjulia> using Flux, BenchmarkTools
julia> x = randn(Float32, 128, 128, 32, 32);
julia> dconv = DepthwiseConv((3,3), 32 => 64)
Conv((3, 3), 32 => 64, groups=32) # 640 parameters
julia> Threads.nthreads()
1
julia> @btime $dconv($x);
169.259 ms (320 allocations: 265.55 MiB) julia> Threads.nthreads()
4
julia> @btime $dconv($x);
96.917 ms (366 allocations: 317.88 MiB) On Masterjulia> using Flux, BenchmarkTools
julia> x = randn(Float32, 128, 128, 32, 32);
julia> dconv = DepthwiseConv((3,3), 32 => 64)
DepthwiseConv((3, 3), 32 => 64) # 640 parameters
julia> Threads.nthreads()
1
julia> @btime $dconv($x);
180.530 ms (22 allocations: 265.51 MiB) julia> Threads.nthreads()
4
julia> @btime $dconv($x);
101.642 ms (37 allocations: 317.83 MiB) |
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.
Great, we can move the perf discussion (mainly figuring out where that extra memory usage comes from) to NNlib.
Implement @mcabbott's comment
Also adds the assertion
for standard convolutions.
Close #1667, close #459