Skip to content
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

improve performance for pooling in forward mode #88

Merged
merged 1 commit into from
Jan 29, 2019

Conversation

KristofferC
Copy link
Contributor

Fixes #87

I tried versions using views and generators but they were all slow.

@codecov-io
Copy link

codecov-io commented Jan 28, 2019

Codecov Report

Merging #88 into master will decrease coverage by 0.74%.
The diff coverage is 40%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #88      +/-   ##
==========================================
- Coverage   70.49%   69.74%   -0.75%     
==========================================
  Files           9        9              
  Lines         583      595      +12     
==========================================
+ Hits          411      415       +4     
- Misses        172      180       +8
Impacted Files Coverage Δ
src/impl/pool.jl 46.58% <40%> (-1.07%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 09482fb...7a3f865. Read the comment docs.

@@ -11,7 +11,11 @@ function max_pooling2d_fwd!(x::AbstractArray{T,4}, y::AbstractArray{T,4},
hstart = max(hstart, 0) + 1
wstart = max(wstart, 0) + 1

y[pw, ph, c, n] = maximum(x[wstart:wend, hstart:hend, c, n])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try just using a view?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at top comment :p. Anyway, to elaborate, the view gets allocated and the loop is super tight so it has terrible performance.

@MikeInnes
Copy link
Member

Awesome stuff, thanks @KristofferC.

@MikeInnes MikeInnes merged commit 9734df6 into FluxML:master Jan 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants