-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add Graphs as States #210
base: master
Are you sure you want to change the base?
Add Graphs as States #210
Conversation
…o graph-states
…o graph-states
It looks like GitHub is down, I will rerun CI tomorrow, but they are green locally |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass at a review. Thanks so much for your amazing work. I am going to mess around with the test cases and environment next to get a better understanding of how things function together. In the meantime, I have some questions.
@@ -255,21 +257,22 @@ def _step( | |||
) | |||
|
|||
new_sink_states_idx = actions.is_exit | |||
new_states.tensor[new_sink_states_idx] = self.sf | |||
sf_tensor = self.States.make_sink_states_tensor((new_sink_states_idx.sum(),)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a comment would be worth adding here.
""" | ||
self.s0 = s0.to(device_str) | ||
self.features_dim = s0["node_feature"].shape[-1] | ||
self.sf = sf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could have a special NoneTensorDict
GraphState
which acts like None
but passes the relevant checks?
self.check_output_dim(out) | ||
self._output_dim_is_checked = True | ||
|
||
assert out.shape[-1] == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also seems like a much harder constraint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? The expected_output_dim
is 1 in this class, so it seems the same to me (actually softer as I don't check the dtype).
) * edge_index_probs + epsilon * uniform_dist_probs | ||
dists["edge_index"] = CategoricalIndexes(probs=edge_index_probs) | ||
|
||
dists["features"] = Normal(module_output["features"], temperature) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree that we should fix it here (i.e., in the Estimator
), or if we do so, we should implement masking properly in the States
class before the release of V2 because this is a clear design pattern violation.
There is no problem adding multiple edges to-from the same node in principle (in say, a multi-attribute graph) but that does make things way more complex, and I think we can safely avoid that complexity here, as single edges to-from the same nodes will cover a lot of AI for Science applications in the near term.
The code runs, thanks for the last change. A few suggestions/questions:
|
Description:
Unlike the current States object that necessitates appending dummy states to batch trajectories of varying lengths, our approach aims to support Trajectories through a nested Batch object representation. The Data class in Torch Geometric represents the graph structure, while the Batch class, which encapsulates batching of Data objects and their efficient indexing, represents the GraphStates object.
The current implementation of Trajectory supports the indexing dimensions: (Num time steps, Num trajectories, State Size). By using a nested Batch of Batch object to represent state Trajectories, the indexing would inherently take the form (Num trajectories, Num timesteps, State size). This approach requires implementing logic within
_getitem_()
and_setitem_()
to internally.To Do:
Compatibility check with Trajectories, Transition class