[Mlir-commits] [mlir] [MLIR][TOSA] Add ERROR_IF checks to TRANSPOSE_CONV2D verifer (PR #133234)

Luke Hutton llvmlistbot at llvm.org
Fri Mar 28 03:08:45 PDT 2025


================
@@ -2896,6 +2896,103 @@ LogicalResult TransposeConv2DOp::inferReturnTypeComponents(
 LogicalResult TransposeConv2DOp::verify() {
   if (verifyConvOp(*this).failed() || verifyConvOpModes(*this).failed())
     return failure();
+
+  const RankedTensorType weightType =
+      llvm::dyn_cast<RankedTensorType>(getWeight().getType());
+  if (!weightType)
+    return success();
+
+  const int64_t kernelHeight = weightType.getDimSize(1);
+  const int64_t kernelWidth = weightType.getDimSize(2);
+
+  // Skip further checks if kernel dimensions are dynamic
+  if (kernelHeight == ShapedType::kDynamic ||
+      kernelWidth == ShapedType::kDynamic)
+    return success();
+
+  llvm::ArrayRef<int64_t> padding = getOutPad();
+  const int64_t outPadTop = padding[0];
+  const int64_t outPadBottom = padding[1];
+  const int64_t outPadLeft = padding[2];
+  const int64_t outPadRight = padding[3];
+
+  if (outPadTop <= -kernelHeight)
----------------
lhutton1 wrote:

Could these checks be simplified in a lambda?

https://github.com/llvm/llvm-project/pull/133234


More information about the Mlir-commits mailing list