diff --git a/src/Conversion/ONNXToTOSA/Tensor/Constant.cpp b/src/Conversion/ONNXToTOSA/Tensor/Constant.cpp index 0af623c4ce..07547e6146 100644 --- a/src/Conversion/ONNXToTOSA/Tensor/Constant.cpp +++ b/src/Conversion/ONNXToTOSA/Tensor/Constant.cpp @@ -44,6 +44,10 @@ class ONNXConstOpLoweringToTOSA : public OpConversionPattern { op, "tosa.const does not support non-tensor types"); } Type resultType = getTypeConverter()->convertType(op.getResult().getType()); + if (!resultType) { + return rewriter.notifyMatchFailure( + op, "tosa.const does not support the requested type"); + } rewriter.replaceOpWithNewOp( op, resultType, currentAttr.cast()); return success();