Skip to content

Handle two-dimensional time embeddings - #1216

Merged
lehendo merged 2 commits into
sunlabuiuc:masterfrom
fbonc:fix-time-embedding-div-zero
Aug 31, 2026
Merged

lehendo merged 2 commits into
sunlabuiuc:masterfrom
fbonc:fix-time-embedding-div-zero

Conversation

@fbonc

@fbonc fbonc commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Issue

SinusoidalTimeEmbedding divided its frequency indices by half - 1. For dim=2, half is 1, so the only frequency was computed as 0/0 and every embedding contained NaN values.

Fix

Clamp to at least 1. This gives the single-frequency case a finite frequency of 1 while leaving the frequency schedule unchanged for all dimensions greater than 2.

Notes

Added regression tests tests/core/test_unified_embedding.py with finite-output coverage for dim=2 and a known-value check for dim=6.

fbonc added 2 commits August 26, 2026 22:50
Avoid a zero frequency denominator for the single-frequency case while preserving existing values for larger dimensions.

@lehendo lehendo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me!

@lehendo
lehendo merged commit 7f86573 into sunlabuiuc:master Aug 31, 2026
2 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.

2 participants