[Mlir-commits] [mlir] [mlir][tosa] Enhance verify checks for PAD Op (PR #137177)
Luke Hutton
llvmlistbot at llvm.org
Fri Apr 25 08:58:08 PDT 2025
================
@@ -1534,15 +1534,49 @@ LogicalResult tosa::PadOp::verify() {
if (!inputType || !outputType)
return success();
- auto paddingRank = cast<tosa::shapeType>(getPadding().getType()).getRank();
+ auto inputRank = inputType.getRank();
+ auto outputRank = outputType.getRank();
+ if (inputRank != outputRank)
+ return emitOpError() << "expect same input and output tensor rank, but got "
+ << "inputRank: " << inputRank
+ << ", outputRank: " << outputRank;
+
+ DenseIntElementsAttr paddingAttr;
+ if (!matchPattern(getPadding(), m_Constant(&paddingAttr)))
+ return failure();
----------------
lhutton1 wrote:
Ah, that'll be because `pad` is a `const_shape` which currently cannot be variable. Happy to leave as a failure in that case
https://github.com/llvm/llvm-project/pull/137177
More information about the Mlir-commits
mailing list