[Mlir-commits] [mlir] [mlir][tosa] Add dim operation (PR #169368)

Sayan Saha llvmlistbot at llvm.org
Wed Dec 24 05:25:58 PST 2025


================
@@ -4663,6 +4648,24 @@ LogicalResult tosa::ConstShapeOp::verify() {
   return success();
 }
 
+LogicalResult tosa::DimOp::verify() {
+  const tosa::shapeType outShapeType =
+      cast<tosa::shapeType>(getResult().getType());
+  if (outShapeType.getRank() != 1)
+    return emitOpError("expect output shape type to contain one element, got ")
+           << outShapeType;
+
+  const ShapeAdaptor inputType(getInput1().getType());
+  if (inputType.hasRank()) {
----------------
sahas3 wrote:

Can this check ever be false since `Tosa_TensorAtLeast1D` is specified as the input to `tosa.dim`?

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


More information about the Mlir-commits mailing list