Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #869 +/- ##
==========================================
- Coverage 97.09% 97.08% -0.01%
==========================================
Files 130 130
Lines 27229 27249 +20
==========================================
+ Hits 26437 26456 +19
- Misses 792 793 +1 🚀 New features to boost your workflow:
|
4718c0f to
ac17a8a
Compare
|
Hi, I independently checked how #869 integrates with #904, which addresses empty-support and native-buffer safety in EMD. |
Types of changes
Description
ot.emdandot.emd2crash the Python interpreter with a segmentation fault when every entry of the cost matrix is NaN or infinite:Everything built on them crashes too, e.g.
ot.solve, andot.gromov.gromov_wasserstein2with an all-NaN structure matrix. That is the case #469 reported; it was closed because a single NaN now gives a NaN result, but a fully NaN matrix still crashes.Only the all-non-finite case crashes. With a NaN or inf row, column, block, or every entry but one, the solver returns an infeasible result (zero plan,
result_code0, the usual "Problem infeasible" warning). The dense solver call now goes through a small_emd_c_densehelper that returns that same infeasible result when no cost is finite, without callingemd_c. Every other input behaves exactly as before. With this,gromov_wasserstein2on an all-NaN structure returns NaN, as for a single NaN.How has this been tested
Added
test_emd_no_finite_cost(NaN and inf) intest/test_ot.py. It coversemd,emd2andgromov_wasserstein2, and it segfaults on master.test_ot.py,test_1d_solver.py,test_solvers.pyandtest/gromovpass (593 passed).Checklist