Skip to content

Commit 6173944

Browse files
committed
Fix single graph handling
1 parent 6ed3ca0 commit 6173944

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

pina/collector.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@ def store_fixed_data(self):
104104
# get data
105105
keys = condition.__slots__
106106
values = [getattr(condition, name) for name in keys]
107-
values = [
108-
value.data if isinstance(value, Graph) else value
109-
for value in values
110-
]
111107
self.data_collections[condition_name] = dict(zip(keys, values))
112108
# condition now is ready
113109
self._is_conditions_ready[condition_name] = True

pina/condition/condition_interface.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,9 @@ def _check_graph_list_consistency(data_list):
115115
raise ValueError(
116116
"LabelTensor must have the same labels"
117117
)
118+
119+
def __getattribute__(self, name):
120+
to_return = super().__getattribute__(name)
121+
if isinstance(to_return, (Graph, Data)):
122+
to_return = [to_return]
123+
return to_return

0 commit comments

Comments
 (0)