Fix single graph handling

This commit is contained in:
FilippoOlivo
2025-04-22 13:25:04 +02:00
committed by Dario Coscia
parent 53cc203db8
commit 05d6913e04
2 changed files with 6 additions and 4 deletions

View File

@@ -104,10 +104,6 @@ class Collector:
# get data # get data
keys = condition.__slots__ keys = condition.__slots__
values = [getattr(condition, name) for name in keys] values = [getattr(condition, name) for name in keys]
values = [
value.data if isinstance(value, Graph) else value
for value in values
]
self.data_collections[condition_name] = dict(zip(keys, values)) self.data_collections[condition_name] = dict(zip(keys, values))
# condition now is ready # condition now is ready
self._is_conditions_ready[condition_name] = True self._is_conditions_ready[condition_name] = True

View File

@@ -115,3 +115,9 @@ class ConditionInterface(metaclass=ABCMeta):
raise ValueError( raise ValueError(
"LabelTensor must have the same labels" "LabelTensor must have the same labels"
) )
def __getattribute__(self, name):
to_return = super().__getattribute__(name)
if isinstance(to_return, (Graph, Data)):
to_return = [to_return]
return to_return