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

add adaptive pooling layers #1233

Closed
wants to merge 0 commits into from
Closed

Conversation

dnabanita7
Copy link
Contributor

I have added AdaptiveMaxPool and AdaptiveMeanPool so that we can do a similar PyTorch implementation. cc @darsnack

PR

  • Tests are added
  • Entry in NEWS.md
  • Documentation, if applicable
  • Final review from @MikeInnes or @dhairyagandhi96 (for API changes).

Flux issue linking

Flux#1224

MLH issue linking

0.3.x-projects#26

Copy link
Member

@darsnack darsnack left a comment

Choose a reason for hiding this comment

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

There are some test errors. Check the Travis log for more details.

#Output_size
out_size = a.out
#Stride
stride = in_size/out_size
Copy link
Member

Choose a reason for hiding this comment

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

Looks like you have test errors with this line. You can look at the Travis build log for more details.

Can you fix this?

#Output_size
out_size = a.out
#Stride
stride = in_size/out_size
Copy link
Member

Choose a reason for hiding this comment

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

Same comment.

src/layers/conv.jl Outdated Show resolved Hide resolved
@darsnack
Copy link
Member

Can you fix the errors from the lines I commented originally? (Hint: you might need broadcasting)

@dnabanita7
Copy link
Contributor Author

ok! actually I have been trying and not getting what is the error and also I can't do tests on my system because of the under lying MLH-Fellowship fork.

@darsnack
Copy link
Member

No problem! insize and outsize are tuples, so you need to use broadcasting to divide them element-wise (e.g. insize ./ outsize). The other issue is that insize will have to extra elements for the channel and batching dimensions. So you want to drop the last two elements: insize[1:end-2].

@darsnack
Copy link
Member

Similar issues with other arithmetic operations involving insize and outsize. You need to add broadcasting for all those cases too.

@darsnack
Copy link
Member

Almost! The broadcasting thing applies to outsize - 1 as well. Tuples are annoying.

@dnabanita7
Copy link
Contributor Author

dnabanita7 commented Jun 19, 2020

Almost! The broadcasting thing applies to outsize - 1 as well. Tuples are annoying.

Yeah, I thought it to be my commit message.

So, the test AdaptiveMaxPool((4, 2))(x) == maxpool(2, PoolDims(2, 2)) is not correct for x = randn(Float32, 10, 10, 3, 2).

@pull pull bot closed this Jun 19, 2020
@darsnack
Copy link
Member

Not sure what happened here with the bot. Yes, that test wouldn't be correct since going from (10, 10) -> (4, 2) means the stride is (2.5, 5). So to get it to work, you would need to add padding.

@dnabanita7
Copy link
Contributor Author

yeah, I am switching back to (10,10) -> (5,5) which would clear all the doubts

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