-
Notifications
You must be signed in to change notification settings - Fork 9
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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ν) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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:
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) |
There was a problem hiding this comment.
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 tosum(plan)
of the initial randomly initializedplan
?
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.
There was a problem hiding this comment.
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
Co-authored-by: David Widmann <[email protected]>
Co-authored-by: David Widmann <[email protected]>
Pull Request Test Coverage Report for Build 4024858001Details
💛 - Coveralls |
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
No description provided.