Skip to content

Commit

Permalink
update code
Browse files Browse the repository at this point in the history
  • Loading branch information
yeliang2258 committed Sep 30, 2022
1 parent 40c7540 commit 3f22ed5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions paddle/fluid/operators/slice_op.cc 100644 → 100755
Expand Up @@ -158,7 +158,7 @@ class SliceOp : public framework::OperatorWithKernel {
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 (this->CanMKLDNNBeUsed(ctx, input_data_type)) {
if (!not_all_zero_dims && this->CanMKLDNNBeUsed(ctx, input_data_type)) {
// 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 All @@ -167,8 +167,7 @@ class SliceOp : public framework::OperatorWithKernel {
phi::vectorize(ctx.Input<phi::DenseTensor>("Input")->dims()),
dnnl::memory::data_type::f32,
ctx.Input<phi::DenseTensor>("Input")->format());
if (tmp_md.data.format_desc.blocking.inner_nblks == 0 &&
not_all_zero_dim)
if (tmp_md.data.format_desc.blocking.inner_nblks == 0)
return framework::OpKernelType(input_data_type,
ctx.GetPlace(),
framework::DataLayout::kMKLDNN,
Expand Down

0 comments on commit 3f22ed5

Please sign in to comment.