Skip to content

Conversation

@josephdviviano
Copy link
Collaborator

  • I've read the .github/CONTRIBUTING.md file
  • My code follows the typing guidelines
  • I've added appropriate tests
  • I've run pre-commit hooks locally

Description

  • Added a utility to facilitate the compilation of a GFlowNet.
  • Added a script demonstrating the utility of compiling the GFlowNet and the loss (or both) under a large number of environments.
  • Added some small fixes that allows Graph environments to work with DB / SubTB.

@josephdviviano josephdviviano self-assigned this Nov 28, 2025
@josephdviviano
Copy link
Collaborator Author

compile_benchmark

Comment on lines +809 to +813
for i in range(batch_size):
edges = states_tensor[i].edge_index
adj[i, edges[0], edges[1]] = 1
if not self.is_directed:
adj[i, edges[1], edges[0]] = 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we care about efficiency here, I am pretty sure this for loop can be vectorized.

Roughly, something like:

B = torch.arange(batch_size)
edges = states_tensor.edge_index
adj[B, edges[:, 0], edges[:, 1] = 1
if not self.is_directed:
   adj[B, edges[:, 1], edges[:, 0]] = 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants