未验证 提交 5033b6c2 编写于 作者: Y yeliang2258 提交者: GitHub

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

* fix slice bugs

* fix

* update code

* fix

* update code
上级 4465ba27
......@@ -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 all_zero_dims = std::all_of(
vec_dims.cbegin(), vec_dims.cend(), [](int64_t i) { return i == 0; });
if (!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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册