Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRG] Refactor: improve readibility in the convolutional module #709

Conversation

framunoz
Copy link
Contributor

@framunoz framunoz commented Dec 27, 2024

Types of changes

Refactor the ot.bregman._convolutional.py module to improve the readability of the module. These includes:

  • Add a function that returns convol_img function.
  • Leave the warning message as a constant in the top of the module.
  • Create a function for the verbose report.

Motivation and context / Related issue

There is a lot of duplicate code in this module, which can be encapsulated in functions to make it more modular.

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.

@framunoz
Copy link
Contributor Author

Why do the _convolutional_barycenter2d_log and _convolutional_barycenter2d_debiased_log functions still throw an error if the jax and tensorflow backends are used? I was checking the functions implemented in these modules, and they are implemented.

Copy link

codecov bot commented Dec 27, 2024

Codecov Report

Attention: Patch coverage is 97.67442% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.08%. Comparing base (39cd6ec) to head (667ea6d).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #709      +/-   ##
==========================================
+ Coverage   97.06%   97.08%   +0.01%     
==========================================
  Files          98       98              
  Lines       19955    19937      -18     
==========================================
- Hits        19370    19355      -15     
+ Misses        585      582       -3     

@cedricvincentcuaz
Copy link
Collaborator

Hi @framunoz,

Thank you for doing some cleaning. I think that we just forgot to remove exceptions in these functions. Could you please remove them and adjust the tests ?

@github-actions github-actions bot added the Tests label Jan 8, 2025
@framunoz
Copy link
Contributor Author

framunoz commented Jan 9, 2025

Ok, I see why they methods raise these errors. In that functions they assign a value in a specific element (in the line log_KU[k] = ...) and that operation is not allowed for jax and tensorflow. I'm going to undo the last two commits.

@cedricvincentcuaz
Copy link
Collaborator

Ok thanks for the reminder, we should fix that soon. That would be much appreciated if you have time to deal with that in another PR.
Thank you for your PR i'll merge it :)

@cedricvincentcuaz cedricvincentcuaz merged commit 200322b into PythonOT:master Jan 10, 2025
18 checks passed
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