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

Use log1p(x) instead of log(1+x) #2539

Closed
wants to merge 1 commit into from
Closed

Use log1p(x) instead of log(1+x) #2539

wants to merge 1 commit into from

Conversation

kit1980
Copy link
Member

@kit1980 kit1980 commented Sep 16, 2024

This function is more accurate than torch.log() for small values of input - https://pytorch.org/docs/stable/generated/torch.log1p.html

Found with https://github.com/pytorch-labs/torchfix/

This function is more accurate than torch.log() for small values of input - https://pytorch.org/docs/stable/generated/torch.log1p.html

Found with https://github.com/pytorch-labs/torchfix/
@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Sep 16, 2024
Copy link

codecov bot commented Sep 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.98%. Comparing base (e9ce11f) to head (fa485ea).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2539   +/-   ##
=======================================
  Coverage   99.98%   99.98%           
=======================================
  Files         193      193           
  Lines       17010    17010           
=======================================
  Hits        17007    17007           
  Misses          3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@saitcakmak saitcakmak left a comment

Choose a reason for hiding this comment

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

Thanks @kit1980! Happy to stamp the diff if you want to import the PR into fbcode.

@facebook-github-bot
Copy link
Contributor

@kit1980 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@kit1980 merged this pull request in 200cb2a.

kit1980 added a commit to pytorch-labs/torchfix that referenced this pull request Sep 17, 2024
Suggest using `torch.log1p(x)` instead of `torch.log(1 + x)`.
Only a checker for now, probably not worth spending time on a codemod as
it's not a very common issue.

I used this to create a PR to botorch
pytorch/botorch#2539
@saitcakmak saitcakmak deleted the sdym/log1p branch September 22, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants