Skip to content

Override max_pool2d as autograd function.#2236

Merged
ailzhang merged 1 commit intopytorch:masterfrom
ailzhang:lower_max_pool2d
Jun 20, 2020
Merged

Override max_pool2d as autograd function.#2236
ailzhang merged 1 commit intopytorch:masterfrom
ailzhang:lower_max_pool2d

Conversation

@ailzhang
Copy link
Copy Markdown
Contributor

No description provided.

@dlibenzi dlibenzi self-requested a review June 18, 2020 13:26
Copy link
Copy Markdown
Collaborator

@dlibenzi dlibenzi left a comment

Choose a reason for hiding this comment

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

Thanks @ailzhang !

torch::IntArrayRef padding,
torch::IntArrayRef dilation, bool ceil_mode) {
ctx->saved_data["kernel_size"] = kernel_size;
ctx->saved_data["stride"] = stride;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I dunno how the saved_data map works, but array-ref are ... refs, so unless the saved_data map has special handling to make copies, will those be valid in the backward?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Arrayref is converted to IValue in the saved map. I'd assume this is okay since 1) it passed test 2) torchvision is using it the same way :D https://github.com/pytorch/vision/blob/e89c4c0198fd8cbd11344564162c68771524b2d7/torchvision/csrc/PSROIPool.h#L83

@ailzhang
Copy link
Copy Markdown
Contributor Author

ailzhang commented Jun 19, 2020

(CI test failure will be fixed by pytorch/pytorch#40265 [pending review]

@ailzhang ailzhang requested a review from dlibenzi June 19, 2020 20:07
Copy link
Copy Markdown
Collaborator

@dlibenzi dlibenzi left a comment

Choose a reason for hiding this comment

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

Thanks @ailzhang !
One minor nit otherwise LGTM!


ExpectCounterNotChanged("aten::.*", cpp_test::GetIgnoredCounters());
ExpectCounterChanged("xla::max_pool3d_with_indices",
ExpectCounterChanged("xla::max_pool3d",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Remind me to make a pass on this file and move those test before returning from function 😄
No need to do it here.

@ailzhang ailzhang merged commit ce76ba3 into pytorch:master Jun 20, 2020
@ailzhang ailzhang deleted the lower_max_pool2d branch June 20, 2020 19:03
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.

2 participants