-
Notifications
You must be signed in to change notification settings - Fork 26.3k
avg_pool2d avg_pool3d for LongTensor #22433
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
Conversation
facebook-github-bot
left a comment
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.
@ifedan has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
This PR depends on pytorch/vision#1083 |
aten/src/ATen/Dispatch.h
Outdated
|
|
||
| template<> | ||
| struct ScalarTypeToCType<at::ScalarType::Long> { | ||
| using type = int64_t ; |
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.
nit: spacing.
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.
fixed
| int padT, int padH, int padW, | ||
| bool count_include_pad, | ||
| int offsetZ) | ||
| int offsetZ, int divisor_override) |
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.
I think I asked this before, but is there a reason that optional doesn't work herE?
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.
it's not allowed to call a host function c10::optional::value from a global function
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.
ah, you might be able to fix that by making value a C10_HOST_DEVICE function, but this seems fine.
| to compute the output shape. Default: ``False`` | ||
| count_include_pad: when True, will include the zero-padding in the | ||
| averaging calculation. Default: ``True`` | ||
| divisor_override: if specified, it will be used as divisor, otherwise |
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.
I don't think this is accurate, count_include_pad is also potentially used.
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.
changed
| to compute the output shape | ||
| count_include_pad: when True, will include the zero-padding in the | ||
| averaging calculation | ||
| divisor_override: if specified, it will be used as divisor, otherwise |
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.
same here.
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.
changed
| def symbolic_fn(g, input, kernel_size, stride, padding, ceil_mode, count_include_pad, divisor_override=None): | ||
| if ceil_mode and input.type().kind() != "CompleteTensorType": | ||
| return _unimplemented(name, "input size not accesible") | ||
| if divisor_override and divisor_override.node().kind() != 'prim::Constant': |
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.
shouldn't this check if it's None type or something? This looks like a constant would pass but not actually be passed to the operator.
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.
It's similar to ceil_mode. In case if the value will be provided, type().kind() == "ONNX:Constant"
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.
I don't see what ceil_mode has to do with it. @houseroad can you look at this?
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.
I checked two cases: divisor_override not provided, divisor_override is provided. And if divisor_override is not provided it will converted to prim::Constant, otherwise it will be ONNX:Constant.
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.
what is the meaning of divisor_override? We would like to check the value of divisor_override to determine whether we can express it in ONNX or not. If not, call _unimplemented is the right choice.
|
@pytorchbot retest this please |
facebook-github-bot
left a comment
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.
@ifedan has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@pytorchbot retest this please |
gchanan
left a comment
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.
would prefer if @houseroad would take a look at the onnx stuff.
facebook-github-bot
left a comment
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.
@ifedan has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@pytorchbot retest this please |
|
@ailzhang can we do the changes on XLA side? We blocked on rocm failures |
|
@ailzhang I also can create PR for review |
|
@ifedan This should be easy to follow I think. Feel free to land when it's ready. I will prepare a fix on xla side. :) |
facebook-github-bot
left a comment
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.
@ifedan has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: Generate avg_pool2d/avg_pool3d for LongTensor for CPU. Added divisor_override parameter. Pull Request resolved: pytorch/pytorch#22433 Differential Revision: D16108809 Pulled By: ifedan fbshipit-source-id: 8de7ff585a0479702cceafb5ccf9dfea62a9cc50
Generate avg_pool2d/avg_pool3d for LongTensor for CPU.
Added divisor_override parameter.