(nx, reg, reg_type, unbalanced, unbalanced_type, alpha, loss)
| 420 | ), |
| 421 | ) |
| 422 | def test_solve_gromov_grid(nx, reg, reg_type, unbalanced, unbalanced_type, alpha, loss): |
| 423 | np.random.seed(0) |
| 424 | |
| 425 | n_samples_s = 3 |
| 426 | n_samples_t = 5 |
| 427 | |
| 428 | Ca = np.random.rand(n_samples_s, n_samples_s) |
| 429 | Ca = (Ca + Ca.T) / 2 |
| 430 | |
| 431 | Cb = np.random.rand(n_samples_t, n_samples_t) |
| 432 | Cb = (Cb + Cb.T) / 2 |
| 433 | |
| 434 | a = ot.utils.unif(n_samples_s) |
| 435 | b = ot.utils.unif(n_samples_t) |
| 436 | |
| 437 | M = np.random.rand(n_samples_s, n_samples_t) |
| 438 | |
| 439 | try: |
| 440 | sol0 = ot.solve_gromov( |
| 441 | Ca, |
| 442 | Cb, |
| 443 | reg=reg, |
| 444 | reg_type=reg_type, |
| 445 | unbalanced=unbalanced, |
| 446 | unbalanced_type=unbalanced_type, |
| 447 | loss=loss, |
| 448 | ) # GW |
| 449 | sol0_fgw = ot.solve_gromov( |
| 450 | Ca, |
| 451 | Cb, |
| 452 | M, |
| 453 | reg=reg, |
| 454 | reg_type=reg_type, |
| 455 | unbalanced=unbalanced, |
| 456 | unbalanced_type=unbalanced_type, |
| 457 | alpha=alpha, |
| 458 | loss=loss, |
| 459 | ) # FGW |
| 460 | |
| 461 | # solve in backend |
| 462 | ax, bx, Mx, Cax, Cbx = nx.from_numpy(a, b, M, Ca, Cb) |
| 463 | |
| 464 | solx = ot.solve_gromov( |
| 465 | Cax, |
| 466 | Cbx, |
| 467 | reg=reg, |
| 468 | reg_type=reg_type, |
| 469 | unbalanced=unbalanced, |
| 470 | unbalanced_type=unbalanced_type, |
| 471 | loss=loss, |
| 472 | ) # GW |
| 473 | solx_fgw = ot.solve_gromov( |
| 474 | Cax, |
| 475 | Cbx, |
| 476 | Mx, |
| 477 | reg=reg, |
| 478 | reg_type=reg_type, |
| 479 | unbalanced=unbalanced, |
nothing calls this directly
no test coverage detected