Add checks in ReduceWindowOpOnTensorsConversion.

The pattern does not support ops with non-zero padding config. Add a check to
prevent unexpected lowering.

It is not easy to add tests because other patterns will convert body ops, and
it causes issues like invalid IRs.

PiperOrigin-RevId: 367202450
This commit is contained in:
Hanhan Wang 2021-04-07 05:45:07 -07:00 committed by TensorFlow MLIR Team
parent c6894333b9
commit c466f08993
1 changed files with 4 additions and 0 deletions

View File

@ -1712,6 +1712,10 @@ struct ReduceWindowOpOnTensorsConversion
return rewriter.notifyMatchFailure(op, "expected NHWC pooling-based op");
}
if (op.padding() && !isSplatValue(*op.padding(), 0)) {
return rewriter.notifyMatchFailure(op, "require paddings are all zero");
}
SmallVector<int64_t, 2> shapes;
shapes.push_back(op.window_dimensions().getValue<int64_t>(1));
shapes.push_back(op.window_dimensions().getValue<int64_t>(2));