Remove HasValueSemantics from `is` ops.

pull/986/merge
Sean Silva 2022-07-15 22:40:22 +00:00
parent d70bb68c9e
commit 795479a88d
2 changed files with 5 additions and 2 deletions

View File

@ -7596,7 +7596,6 @@ def Torch_AtenNeBoolOp : Torch_Op<"aten.ne.bool", [
def Torch_Aten__Is__Op : Torch_Op<"aten.__is__", [
AllowsTypeRefinement,
HasValueSemantics,
ReadOnly
]> {
let summary = "Generated op for `aten::__is__ : (t1, t2) -> (bool)`";
@ -7621,7 +7620,6 @@ def Torch_Aten__Is__Op : Torch_Op<"aten.__is__", [
def Torch_Aten__Isnot__Op : Torch_Op<"aten.__isnot__", [
AllowsTypeRefinement,
HasValueSemantics,
ReadOnly
]> {
let summary = "Generated op for `aten::__isnot__ : (t1, t2) -> (bool)`";

View File

@ -251,6 +251,11 @@ class JitOperator:
# but the alias annotation is empty.
if self.unique_key == "prim::unchecked_cast : (t) -> (t)":
return False
# The `is` operator compares object identity, so it does not have
# value semantics.
if self.unique_key in ("aten::__is__ : (t1, t2) -> (bool)",
"aten::__isnot__ : (t1, t2) -> (bool)"):
return False
return True
def is_readonly(self):