Skip to content

Fix single graph handling #554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions pina/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ def store_fixed_data(self):
# get data
keys = condition.__slots__
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))
# condition now is ready
self._is_conditions_ready[condition_name] = True
Expand Down
6 changes: 6 additions & 0 deletions pina/condition/condition_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,9 @@ def _check_graph_list_consistency(data_list):
raise ValueError(
"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
Loading