File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -155,8 +155,10 @@ class SliceOp : public framework::OperatorWithKernel {
155
155
#ifdef PADDLE_WITH_MKLDNN
156
156
auto input_data_type =
157
157
framework::OperatorWithKernel::IndicateVarDataType (ctx, " Input" );
158
-
159
- if (this ->CanMKLDNNBeUsed (ctx, input_data_type)) {
158
+ auto vec_dims = phi::vectorize (in_tensor.dims ());
159
+ bool all_zero_dims = std::all_of (
160
+ vec_dims.cbegin (), vec_dims.cend (), [](int64_t i) { return i == 0 ; });
161
+ if (!all_zero_dims && this ->CanMKLDNNBeUsed (ctx, input_data_type)) {
160
162
// OneDNN uses blocking format, which cannot be always supported with
161
163
// reorders, because if blocked dimension is not divisible by 8 or
162
164
// 16(depending on which blocking format is used) submemory cannot be
You can’t perform that action at this time.
0 commit comments