Skip to content

Commit

Permalink
fix pre_transform in InMemoryDataset
Browse files Browse the repository at this point in the history
  • Loading branch information
rusty1s committed Dec 2, 2020
1 parent 26335c3 commit bcdb323
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions torch_geometric/data/in_memory_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ def len(self):
return 0

def get(self, idx):
if self.__data_list__ is None:
self.__data_list__ = self.len() * [None]
else:
data = self.__data_list__[idx]
if data is not None:
return copy.copy(data)
if hasattr(self, '__data_list__'):
if self.__data_list__ is None:
self.__data_list__ = self.len() * [None]
else:
data = self.__data_list__[idx]
if data is not None:
return copy.copy(data)

data = self.data.__class__()
if hasattr(self.data, '__num_nodes__'):
Expand All @@ -90,7 +91,9 @@ def get(self, idx):
s = slice(start, end)
data[key] = item[s]

self.__data_list__[idx] = copy.copy(data)
if hasattr(self, '__data_list__'):
self.__data_list__[idx] = copy.copy(data)

return data

@staticmethod
Expand Down

0 comments on commit bcdb323

Please sign in to comment.