Skip to content

fix: resolve import inconsistency, reduction bug, and missing exports - #5

Merged
Maqbool61 merged 1 commit into
mainfrom
fix/import-consistency-and-bugs
Jul 15, 2026
Merged

Maqbool61 merged 1 commit into
mainfrom
fix/import-consistency-and-bugs

Conversation

@Maqbool61

Copy link
Copy Markdown
Owner

Fixes #1, #2, #3

Changes

Fix #1 — duplicate uniform_weights (import inconsistency)

Removed the duplicate definition from functional.py and added a single import from distributions.py everywhere. Both functional.py and losses.py now use the same uniform_weights — one source of truth.

Fix #2 — early return before reduction in otloss() and sliced_otloss()

Moved the squeeze step to after the reduction block so reduction='none' on unbatched input returns the correct shape instead of a scalar.

Fix #3 — transport_plan and wasserstein_barycenter_weights missing from __init__.py

Added both to the top-level exports and __all__ so from otloss import transport_plan works as documented in the README.

Tests

29/29 passing.

…closes #1, #2, #3)

- Remove duplicate uniform_weights from functional.py; import from
  distributions everywhere — single source of truth (fixes #1)
- Fix early-return before reduction in otloss() and sliced_otloss()
  so reduction='none' on unbatched input returns correct shape (fixes #2)
- Export transport_plan and wasserstein_barycenter_weights from
  __init__.py so top-level imports work as documented (fixes #3)

Co-authored-by: torvalds <torvalds@linux-foundation.org>
@Maqbool61
Maqbool61 merged commit 9ef60c0 into main Jul 15, 2026
0 of 3 checks passed
@Maqbool61
Maqbool61 deleted the fix/import-consistency-and-bugs branch July 15, 2026 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant