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

Fix slice bugs in MKLDNN when input dims are zeros #46671

Merged
merged 5 commits into from Oct 11, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions paddle/fluid/operators/slice_op.cc 100644 → 100755
Expand Up @@ -155,8 +155,10 @@ class SliceOp : public framework::OperatorWithKernel {
#ifdef PADDLE_WITH_MKLDNN
auto input_data_type =
framework::OperatorWithKernel::IndicateVarDataType(ctx, "Input");

if (this->CanMKLDNNBeUsed(ctx, input_data_type)) {
auto vec_dims = phi::vectorize(in_tensor.dims());
bool not_all_zero_dim = std::all_of(
vec_dims.cbegin(), vec_dims.cend(), [](int64_t i) { return i != 0; });
if (!not_all_zero_dims && this->CanMKLDNNBeUsed(ctx, input_data_type)) {
yeliang2258 marked this conversation as resolved.
Show resolved Hide resolved
// OneDNN uses blocking format, which cannot be always supported with
// reorders, because if blocked dimension is not divisible by 8 or
// 16(depending on which blocking format is used) submemory cannot be
Expand Down