[Torch] enhance fold of aten.alias (#3705)

pull/3710/head
Yuanqiang Liu 2024-09-12 17:04:57 +08:00 committed by GitHub
parent bb69014a96
commit 3f07077ff9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -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