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
[c++] Distance-agnostic triplet margin loss #45377
Conversation
[ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit 023aa43 (more details on the Dr. CI page):
1 failure confirmed as flaky and can be ignored:
🚧 1 fixed upstream failure:These were probably caused by upstream breakages that were already fixed.
Please rebase on the
|
This PR adds a C++ implementation of the TripletMarginWithDistanceLoss, for which the Python implementation was introduced in PR #43680. It's based on PR #44072, but I'm resubmitting this to unlink it from Phabricator. cc: @mruberry @albanD @glaringlee [ghstack-poisoned]
ghstack-source-id: 13d5caecceea15fc9c98b8366e15d52c1bd88b83 Pull Request resolved: #45377
@ethch18 |
This PR adds a C++ implementation of the TripletMarginWithDistanceLoss, for which the Python implementation was introduced in PR #43680. It's based on PR #44072, but I'm resubmitting this to unlink it from Phabricator. cc: @mruberry @albanD @glaringlee [ghstack-poisoned]
ghstack-source-id: 2ff77abfce01455332b5905b7bfb246a022cde13 Pull Request resolved: #45377
@@ -180,6 +180,33 @@ Tensor TripletMarginLossImpl::forward( | |||
|
|||
// ============================================================================ | |||
|
|||
TripletMarginWithDistanceLossImpl::TripletMarginWithDistanceLossImpl( | |||
const TripletMarginWithDistanceLossOptions& options_) // NOLINT(modernize-pass-by-value) |
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.
Will complier complain if removing NOLINT(...)
?
I kinda remember c10:optional doesn't work well with std::move. Did you try std::move here?
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.
clint complains about this otherwise; I copied the NOLINT()
from elsewhere in the file.
What would std::move
look like in this case? Looks like everything else in this file uses the same format, minus NOLINT()
if it's not applicable.
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.
You can do the following to avoid that lint error.
TripletMarginWithDistanceLossImpl::TripletMarginWithDistanceLossImpl( TripletMarginWithDistanceLossOptions options_) : options(std::move(options_)) {}
But I kinda remember std::move is not working well with c10::optional which is inside options. But if you can try, that would be great.
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.
std::move couldn't build once for me locally, then it started building -- not sure if it's a flaky failure. I've pushed this and if the CI fails, then I'll go back to pass-by-reference
This PR adds a C++ implementation of the TripletMarginWithDistanceLoss, for which the Python implementation was introduced in PR #43680. It's based on PR #44072, but I'm resubmitting this to unlink it from Phabricator. cc: @mruberry @albanD @glaringlee [ghstack-poisoned]
ghstack-source-id: 6cd50e4f3c80baa39723fcb129366a442bfa26f1 Pull Request resolved: #45377
Codecov Report
@@ Coverage Diff @@
## gh/ethch18/5/base #45377 +/- ##
=====================================================
- Coverage 68.56% 68.15% -0.41%
=====================================================
Files 405 396 -9
Lines 51937 51131 -806
=====================================================
- Hits 35610 34849 -761
+ Misses 16327 16282 -45
Continue to review full report at Codecov.
|
@ethch18 |
@glaringlee great! FYI, Mike asked me to incorporate the changes from PR #45378 into this one too, which I'll do shortly |
@ethch18 sure, go ahead! |
This PR adds a C++ implementation of the TripletMarginWithDistanceLoss, for which the Python implementation was introduced in PR #43680. It's based on PR #44072, but I'm resubmitting this to unlink it from Phabricator. cc: @mruberry @albanD @glaringlee [ghstack-poisoned]
ghstack-source-id: 13b4775af1a0e433ec85310c9d127581b0502277 Pull Request resolved: #45377
@glaringlee updated -- let me know if you need anything else from my end! |
@ethch18 |
This PR adds a C++ implementation of the TripletMarginWithDistanceLoss, for which the Python implementation was introduced in PR #43680. It's based on PR #44072, but I'm resubmitting this to unlink it from Phabricator. cc: @mruberry @albanD @glaringlee [ghstack-poisoned]
ghstack-source-id: f0ea5ff8fa766154cb7bf240bc4620ba0b66443f Pull Request resolved: #45377
@glaringlee Just rebased on fbcode/warm |
@ethch18 |
This PR adds a C++ implementation of the TripletMarginWithDistanceLoss, for which the Python implementation was introduced in PR #43680. It's based on PR #44072, but I'm resubmitting this to unlink it from Phabricator. cc: @mruberry @albanD @glaringlee [ghstack-poisoned]
@glaringlee rebased with fbcode/warm again. If this doesn't work, I'll try viable/strict next |
ghstack-source-id: 9b60cfa8377a8a4dfa60a3e1955eb710881a7f8a Pull Request resolved: #45377
@ethch18 |
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.
LGTM now
This pull request has been merged in c9bb990. |
Stack from ghstack:
This PR adds a C++ implementation of the TripletMarginWithDistanceLoss, for which the Python implementation was introduced in PR #43680. It's based on PR #44072, but I'm resubmitting this to unlink it from Phabricator.
cc: @mruberry @albanD @glaringlee
Differential Revision: D24003973