Skip to content

Handle two-dimensional time embeddings - #1216

Open
fbonc wants to merge 2 commits into
sunlabuiuc:masterfrom
fbonc:fix-time-embedding-div-zero
Open

Handle two-dimensional time embeddings#1216
fbonc wants to merge 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.
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