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

Entropy-regularised Gromov-Wasserstein #165

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open

Entropy-regularised Gromov-Wasserstein #165

wants to merge 27 commits into from

Conversation

zsteve
Copy link
Member

@zsteve zsteve commented Mar 8, 2022

No description provided.

src/gromov.jl Outdated Show resolved Hide resolved
src/gromov.jl Outdated Show resolved Hide resolved
src/gromov.jl Outdated Show resolved Hide resolved
test/gromov.jl Outdated Show resolved Hide resolved
test/gromov.jl Outdated Show resolved Hide resolved
test/gromov.jl Outdated Show resolved Hide resolved
test/gpu/simple_gpu.jl Outdated Show resolved Hide resolved
@zsteve zsteve marked this pull request as ready for review January 23, 2023 04:04
.github/workflows/CI.yml Outdated Show resolved Hide resolved
gpu/Manifest.toml Outdated Show resolved Hide resolved
gpu/Project.toml Outdated Show resolved Hide resolved
src/gromov.jl Outdated

function get_new_cost!(C, plan, tmp, Cμ, Cν)
A_batched_mul_B!(tmp, Cμ, plan)
return A_batched_mul_B!(C, tmp, -4Cν)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The multiplication with -4 introduces additional allocations. I wonder if this could be avoided, e.g., by updating in-place or some additional cache.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dealt with now (in-place scaling of tmp)

src/gromov.jl Outdated
if to_check_step == 0 || iter == maxiter
# reset counter
to_check_step = check_convergence
isconverged = sum(abs, plan - plan_prev) < max(_atol, _rtol * norm_plan)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

norm_plan is never updated it seems but always set to sum(plan) of the initial randomly initialized plan?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also avoid allocations here by writing:

Suggested change
isconverged = sum(abs, plan - plan_prev) < max(_atol, _rtol * norm_plan)
plan_prev .-= plan # used as a temporary array here to reduce allocations
isconverged = sum(abs, plan_prev) < max(_atol, _rtol * norm_plan)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

norm_plan is never updated it seems but always set to sum(plan) of the initial randomly initialized plan?

The initial plan is taken to be the independent coupling and here we only consider the balanced problem, so norm_plan should not change. I agree however this is a special case of the unbalanced problem where it would not be constant.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also avoid allocations here by writing:

Good catch, done

test/Project.toml Outdated Show resolved Hide resolved
test/runtests.jl Outdated Show resolved Hide resolved
test/runtests.jl Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Jan 27, 2023

Pull Request Test Coverage Report for Build 4024858001

Details

  • 33 of 33 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 95.518%

Totals Coverage Status
Change from base Build 2897651829: 0.2%
Covered Lines: 682
Relevant Lines: 714

💛 - Coveralls

@codecov-commenter
Copy link

codecov-commenter commented Jan 27, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.53%. Comparing base (9da044c) to head (39f0b36).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #165      +/-   ##
==========================================
+ Coverage   95.30%   95.53%   +0.22%     
==========================================
  Files          14       15       +1     
  Lines         681      716      +35     
==========================================
+ Hits          649      684      +35     
  Misses         32       32              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/gromov.jl Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants