-
Notifications
You must be signed in to change notification settings - Fork 260
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
enable DNNL Python OPs(adaptive_avg_pool2d, max_pool2d, max_pool3d) t… #7
Conversation
@@ -25,7 +26,15 @@ def backward(ctx, grad_output): | |||
class MaxPoolingFunction(Function): | |||
@staticmethod | |||
def forward(ctx, input, kernel_size, stride, padding, dilation, ceil_mode): | |||
output = core.max_pooling(input, (kernel_size,), (stride,), (padding,), (dilation,), ceil_mode) | |||
if type(kernel_size) is int: |
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.
torch.nn.modules.utils._single
could serve the same purpose
from torch.nn.modules.utils import _single
kernel_size = _single(kernel_size)
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.
OK, thanks
if input.device.type == 'dpcpp' and core.get_auto_dnnl(): | ||
return AdaptiveAvgPool2dFunction.apply(input, output_size) | ||
except RuntimeError: | ||
return torch_adaptive_avg_pool2d(input, output_size) |
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.
may use pass
in except
block to avoid duplicate fallback code?
Please check if pass all unit test case. |
…o fallback to CPU.
enable DNNL Python OPs(adaptive_avg_pool2d, max_pool2d, max_pool3d) to fallback to CPU.