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

Benjamin Maxwell llvmlistbot at llvm.org
Thu Aug 8 11:37:08 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()) {
----------------
MacDue wrote:

Could this just be `newPerm.empty()`. I think that's only possible in the all-unit dim case.

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


More information about the Mlir-commits mailing list