forked from llvm/torch-mlir
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Torch] Fix PrimListUnpackOp::getCanonicalizationPatterns (llvm#3140)
Fix the case PrimListUnpackOp's result num is not equal to PrimList length. See the following example: ```python def forward(self, x): if len(x.shape) == 5: b0, t, c0, h0, w0 = x.shape b, c, h, w = torch.mul(b0, t), c0, h0, w0 else: b1, c1, h1, w1 = x.shape b, c, h, w = b1, c1, h1, w1 res = torch.reshape(x, [b, c, h, w]) return res ``` Without this fix, the following error message will occur: ``` /root/torch-mlir/externals/llvm-project/mlir/lib/IR/PatternMatch.cpp:118: virtual void mlir::RewriterBase::replaceOp(mlir::Operation *, mlir::ValueRange): Assertion `op->getNumResults() == newValues.size() && "incorrect # of replacement values"' failed. ```
- Loading branch information
Xinyu Yang
authored
Apr 11, 2024
1 parent
6524838
commit 308c45e
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters