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

paddle.nn.func.cosine_embedding_loss #16728

Merged
merged 5 commits into from
Jun 26, 2023

Conversation

mobley-trent
Copy link
Contributor

Closes #16727

@mobley-trent
Copy link
Contributor Author

@hmahmood24 please review this PR

@ivy-leaves ivy-leaves added the Paddle Frontend Developing the Paddle Frontend, checklist triggered by commenting add_frontend_checklist label Jun 19, 2023
Copy link
Contributor

@fnhirwa fnhirwa left a comment

Choose a reason for hiding this comment

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

Hey @mobley-trent

Sorry for being late to review this PR🙂, somehow didn't notice it.
Would you update with the latest master branch changes for me to be able to run tests locally.

Thanks😊

Copy link
Contributor

@fnhirwa fnhirwa left a comment

Choose a reason for hiding this comment

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

Hey @mobley-trent

Below are comments for changes, also is it possible to check the loss for large dimensions like 5 😅, try to explore if that's possible.
Thanks😊

)

prod_sum = (input1 * input2).sum(axis=-1)
mag_square1 = ivy.square(input1).sum(axis=-1) + 10e-12
Copy link
Contributor

Choose a reason for hiding this comment

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

For proper notation we can use

Suggested change
mag_square1 = ivy.square(input1).sum(axis=-1) + 10e-12
mag_square1 = ivy.square(input1).sum(axis=-1) + 1e-12

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Won't this intefere with the final values ?

Copy link
Contributor

Choose a reason for hiding this comment

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

It won’t interfere as this is epsilon value and the notation should be scientific😄

ivy/functional/frontends/paddle/nn/functional/loss.py Outdated Show resolved Hide resolved
ivy/functional/frontends/paddle/nn/functional/loss.py Outdated Show resolved Hide resolved
ivy/functional/frontends/paddle/nn/functional/loss.py Outdated Show resolved Hide resolved
ivy/functional/frontends/paddle/nn/functional/loss.py Outdated Show resolved Hide resolved
ivy/functional/frontends/paddle/nn/functional/loss.py Outdated Show resolved Hide resolved
ivy/functional/frontends/paddle/nn/functional/loss.py Outdated Show resolved Hide resolved
@mobley-trent
Copy link
Contributor Author

Hey @mobley-trent

Below are comments for changes, also is it possible to check the loss for large dimensions like 5 😅, try to explore if that's possible. Thanks😊

The function only works for 1D or 2D tensors 😅 @hirwa-nshuti

@fnhirwa fnhirwa self-requested a review June 26, 2023 07:56
Copy link
Contributor

@fnhirwa fnhirwa left a comment

Choose a reason for hiding this comment

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

Hey @mobley-trent

Now the tests are passing and all looks great😊
Feel free to merge this item🙂

@mobley-trent mobley-trent merged commit a06a4f1 into ivy-llc:master Jun 26, 2023
Sam-Armstrong pushed a commit to Sam-Armstrong/ivy that referenced this pull request Jun 27, 2023
@mobley-trent mobley-trent deleted the cos_embd_loss branch June 30, 2023 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Paddle Frontend Developing the Paddle Frontend, checklist triggered by commenting add_frontend_checklist
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cosine_embedding_loss
4 participants