Skip to content

Fix device placement in expected sliced plans - #846

Open
cananoo wants to merge 1 commit into
PythonOT:masterfrom
cananoo:fix/expected-sliced-plan-device
Open

Fix device placement in expected sliced plans#846
cananoo wants to merge 1 commit into
PythonOT:masterfrom
cananoo:fix/expected-sliced-plan-device

Conversation

@cananoo

@cananoo cananoo commented Aug 30, 2026

Copy link
Copy Markdown

Summary

  • preserve the input dtype and device for default weights in sliced_plans and expected_sliced_plan
  • compute the expected sliced-plan cost with sparse_ot_dist so sparse plans do not materialize a full distance matrix
  • fix sparse_ot_dist to apply per-pair weights in batch order
  • add regression coverage for dense/sparse plans, implicit/explicit weights, and weighted sparse distances

Closes #845

Validation

  • pre-commit run --files ot/sliced/_sliced_plans.py ot/utils.py test/sliced/test_sliced_plans.py test/test_utils.py
  • NumPy source smoke tests for dense/sparse plans and weighted sparse distances
  • python -m compileall -q ot/sliced/_sliced_plans.py ot/utils.py test/sliced/test_sliced_plans.py test/test_utils.py

The full test suite could not be built locally because this Windows environment does not have MSVC for POT's Cython extensions. The PyTorch regression test runs on CPU or CUDA when the backend is available in CI.

@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.86%. Comparing base (9439b8a) to head (bf66aa3).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #846   +/-   ##
=======================================
  Coverage   96.86%   96.86%           
=======================================
  Files         128      128           
  Lines       25947    25972   +25     
=======================================
+ Hits        25133    25158   +25     
  Misses        814      814           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ot.sliced.expected_sliced_plan fails on pytorch CUDA tensors

1 participant