Skip to content

Commit

Permalink
[Torch] enhance fold of aten.alias (#3705)
Browse files Browse the repository at this point in the history
  • Loading branch information
qingyunqu authored Sep 12, 2024
1 parent bb69014 commit 3f07077
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/Dialect/Torch/IR/TorchOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3505,7 +3505,11 @@ atenBinaryFloatOperatorFoldHelper(ArrayRef<Attribute> operands,
// AtenAliasOp
//===----------------------------------------------------------------------===//

OpFoldResult AtenAliasOp::fold(FoldAdaptor adaptor) { return getOperand(); }
OpFoldResult AtenAliasOp::fold(FoldAdaptor adaptor) {
if (getOperand().getType() != getResult().getType())
return {};
return getOperand();
}

//===----------------------------------------------------------------------===//
// AtenFloordivIntOp
Expand Down

0 comments on commit 3f07077

Please sign in to comment.