[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:13 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;
----------------
FranklandJack wrote:

Could we move this into the if condition using an init-statement `if`?
```
if (int64_t inputZpVal; getInputZeroPoint(inputZpVal).succeeded() ...
```

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


More information about the Mlir-commits mailing list