diff --git a/include/torch-mlir/Dialect/Torch/IR/GeneratedTorchOps.td b/include/torch-mlir/Dialect/Torch/IR/GeneratedTorchOps.td index 0f56c1bc1317..4a1f98768933 100644 --- a/include/torch-mlir/Dialect/Torch/IR/GeneratedTorchOps.td +++ b/include/torch-mlir/Dialect/Torch/IR/GeneratedTorchOps.td @@ -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)`"; diff --git a/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/registry.py b/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/registry.py index 7d2568e584b6..00799de1e5cc 100644 --- a/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/registry.py +++ b/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/registry.py @@ -251,6 +251,11 @@ def has_value_semantics(self): # 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):