Skip to content

fix(gat): stack y_prob via numpy before torch.tensor#17

Merged
protosphinx merged 1 commit intomainfrom
fix/eval-tensor-conversion
Apr 29, 2026
Merged

fix(gat): stack y_prob via numpy before torch.tensor#17
protosphinx merged 1 commit intomainfrom
fix/eval-tensor-conversion

Conversation

@protosphinx
Copy link
Copy Markdown
Member

Re-applies the optimization originally proposed by @adamya-singh in #8 on top of the post-audit code (which had drifted enough that #8 conflicted).

torch.tensor(list_of_numpy_arrays) walks every element through Python; stacking with numpy first is ~10× faster on real validation sets and silences the "extremely slow" PyTorch warning.

Closes #8 once merged.

…onversion warning)

`torch.tensor(list_of_numpy_arrays)` walks every element through Python
on the conversion path, which on real-sized BPI logs is meaningfully
slower (~10x in the original measurement) than stacking with numpy
first. PyTorch even prints an "extremely slow" warning. Switch to
`torch.from_numpy(np.stack(...))` and guard the empty-list case.

Credit: spotted and originally fixed in #8 by @adamya-singh; reapplied
on top of the audit refactor since the original PR conflicted with the
node-level head.
@protosphinx protosphinx merged commit 5a88b46 into main Apr 29, 2026
9 checks passed
@protosphinx protosphinx deleted the fix/eval-tensor-conversion branch April 29, 2026 21:50
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.

1 participant