[Mlir-commits] [mlir] [mlir][vector] Handle corner cases in DropUnitDimsFromTransposeOp. (PR #102518)

Han-Chung Wang llvmlistbot at llvm.org
Thu Aug 8 11:41:11 PDT 2024


================
@@ -1771,6 +1771,14 @@ struct DropUnitDimsFromTransposeOp final
       newPerm.push_back(idx - droppedDimsBefore[idx]);
     }
 
+    // Fixup for `newPerm`. The `sourceTypeWithoutUnitDims` could be vector<1xT>
+    // type when the dimensions are unit dimensions. In this case, the newPerm
+    // should be [0].
+    if (sourceTypeWithoutUnitDims.getRank() == 1 &&
+        sourceTypeWithoutUnitDims.getShape()[0] == 1 && newPerm.empty()) {
----------------
hanhanW wrote:

ah, good point!

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


More information about the Mlir-commits mailing list