From ab2b458f0c0f72d3cb573350b324db563066a7ee Mon Sep 17 00:00:00 2001 From: Manan Shah Date: Tue, 17 Dec 2024 09:02:38 -0800 Subject: [PATCH] fix: update `__reduce__` for `EdgeTypeStr` (#9876) Supports `deepcopy` on `EdgeTypeStr`. --- torch_geometric/typing.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/torch_geometric/typing.py b/torch_geometric/typing.py index 468f37abfaed..513f041847b1 100644 --- a/torch_geometric/typing.py +++ b/torch_geometric/typing.py @@ -345,6 +345,9 @@ def to_tuple(self) -> EdgeType: f"tuple since it holds invalid characters") return self.edge_type + def __reduce__(self) -> tuple[Any, Any]: + return (self.__class__, (self.edge_type, )) + # There exist some short-cuts to query edge-types (given that the full triplet # can be uniquely reconstructed, e.g.: