Skip to content

Fix UnbalancedSinkhornTransport transform failing on nx.array_equal (closes #650) - #837

Open
JaySingh79 wants to merge 3 commits into
PythonOT:masterfrom
JaySingh79:fix-650-unbalanced-sinkhorn-nx
Open

Fix UnbalancedSinkhornTransport transform failing on nx.array_equal (closes #650)#837
JaySingh79 wants to merge 3 commits into
PythonOT:masterfrom
JaySingh79:fix-650-unbalanced-sinkhorn-nx

Conversation

@JaySingh79

Copy link
Copy Markdown

fit() now initializes the backend attribute nx before the check_params
gate, matching the behavior of BaseTransport.fit. Previously, a fit call
with missing parameters left self.nx as None, causing any subsequent
transform() call to crash with:
AttributeError: 'NoneType' object has no attribute 'array_equal'

Adds a non-regression test covering both incomplete fit and a separate
transform call.

Types of changes

Motivation and context / Related issue

How has this been tested (if it applies)

PR checklist

  • I have read the CONTRIBUTING document.
  • The documentation is up-to-date with the changes I made (check build artifacts).
  • All tests passed, and additional code has been covered with new tests.
  • I have added the PR and Issue fix to the RELEASES.md file.

…loses PythonOT#650)

fit() now initializes the backend attribute nx before the check_params
gate, matching the behavior of BaseTransport.fit. Previously, a fit call
with missing parameters left self.nx as None, causing any subsequent
transform() call to crash with:
AttributeError: 'NoneType' object has no attribute 'array_equal'

Adds a non-regression test covering both incomplete fit and a separate
transform call.
@github-actions github-actions Bot added the Tests label Aug 22, 2026
@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.86%. Comparing base (62706ab) to head (393a59a).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #837   +/-   ##
=======================================
  Coverage   96.86%   96.86%           
=======================================
  Files         128      128           
  Lines       25709    25724   +15     
=======================================
+ Hits        24902    24917   +15     
  Misses        807      807           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rflamary

Copy link
Copy Markdown
Collaborator

Hello @JaySingh79 thanks for the PR, this is a nice fix, could you please add the information in the RELEASE.md file in the Bug fix section (with referencexs to the Issue and PR)

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants