-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
feat(losses): add hinge_embedding_loss to ivy experimental API. #27048
feat(losses): add hinge_embedding_loss to ivy experimental API. #27048
Conversation
The test are failing locally due to error while using @with_supported_device_and_dtypes decorator.
Thank you for this PR, here is the CI results: This pull request does not result in any additional test failures. Congratulations! |
…/ivy into hinge_embedding_loss
Another key thing to note is that although I have chosen Pytorch: def hinge_embedding_loss(self, target, margin, size_average):
zeros = at.zeros_like(self)
margin_clamp = (margin - self).clamp_min_(0)
output_margin = at.where(target != 1, margin_clamp, zeros)
output_self = at.where(target != -1, self, zeros)
output = (output_margin + output_self).sum() Paddle: def hinge_embedding_loss(input, label, margin=1.0, reduction='mean', name=None):
zero_ = paddle.zeros([1], dtype=input.dtype)
loss = paddle.where(label == 1.0, input, zero_) + paddle.where(
label == -1.0, paddle.nn.functional.relu(margin - input), zero_
) In the In the However, both implementations do not handle cases where the Reference: |
Hi @MahmoudAshraf97, can you please take a look at this once ? |
Hi @akshatvishu |
PR Description
The test are failing locally due to error while using
@with_supported_device_and_dtypes
decorator.For more info regarding the same, please read this discussion at ivy discord.
Update(19 Oct 2023): The above issue is resolved(ref:link)
and the test are also passing locally for all backend but had to turn
test_gradients=False
otherwise tests fail forJAX
andpaddle
backends.Related Issue
Closes #26974
Checklist