Skip to content

Fix GraphConverter three-body index batching - #166

Merged
Daniel Zügner (danielzuegner) merged 1 commit into
microsoft:mainfrom
Lingyu-Kong:fix-three-body-indices-batching
Jul 28, 2026
Merged

Fix GraphConverter three-body index batching#166
Daniel Zügner (danielzuegner) merged 1 commit into
microsoft:mainfrom
Lingyu-Kong:fix-three-body-indices-batching

Conversation

@Lingyu-Kong

Copy link
Copy Markdown

Summary

Fix GraphConverter.convert() to return M3GNetData instead of plain PyG Data.

three_body_indices stores edge indices, so PyG needs M3GNetData.__inc__ to offset those indices by num_bonds when batching multiple graphs. Returning plain Data leaves three_body_indices local to each graph for batch_size > 1, while the current M3GNet forward path expects already-global batched edge indices.

Validation

  • Added a regression test checking that the second graph's three_body_indices are offset by the first graph's num_bonds after Batch.from_data_list.
  • Ran py_compile on the modified files.
  • Ran git diff --check.

@Lingyu-Kong

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks!

@danielzuegner
Daniel Zügner (danielzuegner) merged commit 7af8de4 into microsoft:main Jul 28, 2026
6 of 7 checks passed
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