You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Weighted low-rank LazyTensor integer indexing keeps an extra dimension #892
Integer row indexing of a weighted get_lowrank_lazytensor(Q, R, d) adds an extra leading dimension. A row has shape (1, m) instead of (m,), and a single entry has shape (1,) instead of (). The unweighted tensor and the equivalent dense product have the expected shapes.
On current master c02a25cbb0536bd53ba071acd03733c52c2f3be5:
(1, 3) (3,)
(1,) ()
Expected behavior
Integer and mixed integer/slice indexing should return the same shapes and values as the dense Q @ diag(d) @ R.T, consistently with the unweighted path. Full matrices, block slices, and column slices already have the correct shapes.
Environment
Windows 11 (Windows-11-10.0.26200-SP0), Python 3.12.14.
POT 0.9.8.dev, built from the master commit above with uv pip install --no-build-isolation -e ., including the repository-pinned Eigen submodule.
NumPy 2.5.4, SciPy 1.18.1; the same regression also reproduces with PyTorch 2.14.1 on CPU.
No GPU test was run.
Additional context
The weighted callback multiplies an indexed row by d[None, :], which restores a leading axis when Q[i] is one-dimensional. Broadcasting with d directly preserves the indexed rank. This also affects the lazy_plan returned by lowrank_sinkhorn; I reproduced the row and scalar shapes through that public solver. A focused NumPy/PyTorch regression has 10 shape failures and 24 passing controls on unchanged production source, and all 34 pass with that one-line change.
Activity