[Mlir-commits] [mlir] [mlir][tosa] Check for 0-ranked-tensors during fold (PR #68512)
Sarthak Gupta
llvmlistbot at llvm.org
Tue Oct 10 04:01:19 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) \
----------------
gptsarthak wrote:
Would you like me to change it to `if (inputTy.getRank() == 0 || inputTy.getDimSize(getAxis()) == 1)` ? That would solve the issue and fold rank0 tensors as well.
https://github.com/llvm/llvm-project/pull/68512
More information about the Mlir-commits
mailing list