Skip to content

Commit

Permalink
Avoid transforming original data
Browse files Browse the repository at this point in the history
This PR clones the original data object in `ToUndirected` so that the method does not change the original data
  • Loading branch information
denadai2 authored Jun 7, 2023
1 parent 3b545ee commit 6930b7e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions torch_geometric/transforms/to_undirected.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def forward(
self,
data: Union[Data, HeteroData],
) -> Union[Data, HeteroData]:
data = data.clone()
for store in data.edge_stores:
if 'edge_index' not in store:
continue
Expand Down

0 comments on commit 6930b7e

Please sign in to comment.