Update code for InfoNCE Loss by chenxing1999 · Pull Request #40 · Coder-Yu/SELFRec · GitHub
Skip to content

Update code for InfoNCE Loss#40

Merged
Coder-Yu merged 1 commit into
Coder-Yu:mainfrom
chenxing1999:main
Aug 1, 2023
Merged

Update code for InfoNCE Loss#40
Coder-Yu merged 1 commit into
Coder-Yu:mainfrom
chenxing1999:main

Conversation

@chenxing1999

@chenxing1999 chenxing1999 commented Aug 1, 2023

Copy link
Copy Markdown
Contributor

Hi Dr. Yu,

Thank you for your work.
We could replace the manual log softmax step here with log_softmax function provided by PyTorch to make it slightly faster and more stable.

https://pytorch.org/docs/stable/generated/torch.nn.functional.log_softmax.html


Edit: Here is the benchmark result on Google Colab. I don't know why sometimes it will return speed lower after a couple try lol.
image
https://colab.research.google.com/drive/1flW8XNG5Dh1wwmJH7T1eGncO3hmI13on?usp=sharing

@Coder-Yu

Coder-Yu commented Aug 1, 2023

Copy link
Copy Markdown
Owner

@Coder-Yu Coder-Yu merged commit 5dfd6dc into Coder-Yu:main Aug 1, 2023
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.

2 participants