[Mlir-commits] [mlir] [mlir[tosa] Switch zero point of avgpool2d to input variable type (PR #128983)

Jack Frankland llvmlistbot at llvm.org
Thu Feb 27 06:42:14 PST 2025


================
@@ -481,6 +473,28 @@ LogicalResult tosa::AvgPool2dOp::verify() {
   if (inputETy.isF32() && !accType.isF32())
     return emitOpError("accumulator type for f32 tensor is not f32");
 
+  if (inputETy != inputZpETy)
+    return emitOpError("expect both input and its zero point are the same "
+                       "element type, got ")
+           << inputETy << " and " << inputZpETy;
+
+  if (resultETy != outputZpETy)
+    return emitOpError("expect both output and its zero point are the same "
+                       "element type, got ")
+           << resultETy << " and " << outputZpETy;
+
+  int64_t inputZpVal;
+  if (getInputZeroPoint(inputZpVal).succeeded() &&
+      verifyInputZeroPoint(inputZpVal).failed())
+    return emitOpError(
+        "input zero point must be zero for non-int8 integer types");
+
+  int64_t outputZpVal;
----------------
FranklandJack wrote:

Could this be moved into the `if` condition?

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


More information about the Mlir-commits mailing list