Skip to content

Commit 7c83832

Browse files
committed
Do not emit error in shape inference if this error only means that the shape could not be computed.
Currently some ops mix canonicalization, shape inference, and validation in their inferShapes method, which can lead to confusing error messages and can generally be difficult to understand. In the future I would like to split them up, so that inferShapes does only shape inference, and canonicalization becomes its own method/pattern. Signed-off-by: Rickert, Jonas <[email protected]>
1 parent a4c081c commit 7c83832

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Dialect/ONNX/ONNXOps/Tensor/Resize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ bool isAbsent(Value input) {
4747
LogicalResult ONNXResizeOpShapeHelper::computeShape() {
4848
ONNXResizeOpAdaptor operandAdaptor(operands, cast<ONNXResizeOp>(op));
4949
if (operandAdaptor.getAxes().has_value())
50-
return op->emitOpError("axes are unsupported");
50+
return failure();
5151
const auto x = operandAdaptor.getX();
5252
if (!hasShapeAndRank(x)) {
5353
return failure();

src/Dialect/ONNX/ONNXOps/Tensor/Slice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ LogicalResult ONNXSliceOpShapeHelper::computeShape() {
4343
createIE->getIntFromArrayAsSymbols(axes, axesSymbol);
4444
for (IndexExpr val : axesSymbol) {
4545
if (!val.isLiteral())
46-
return op->emitError("Axes must be known at compile time");
46+
return success();
4747
int64_t axis = val.getLiteral();
4848
if (axis < 0)
4949
axis += dataRank;

0 commit comments

Comments
 (0)