[Mlir-commits] [mlir] [mlir][tosa] Check for 0-ranked-tensors during fold (PR #68512)

Georgios Pinitas llvmlistbot at llvm.org
Tue Oct 10 03:52:10 PDT 2023


================
@@ -771,7 +771,7 @@ OpFoldResult ConstOp::fold(FoldAdaptor adaptor) { return getValueAttr(); }
     ShapedType inputTy = llvm::cast<ShapedType>(getInput().getType());         \
     if (!inputTy.hasRank())                                                    \
       return {};                                                               \
-    if (inputTy.getDimSize(getAxis()) == 1)                                    \
+    if (inputTy.getRank() != 0 && inputTy.getDimSize(getAxis()) == 1)          \
----------------
GeorgeARM wrote:

Shouldn't reduction on rank0 tensor get folded as well?

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


More information about the Mlir-commits mailing list