-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add TorchLog1pVisitor #77
Conversation
@@ -28,15 +29,16 @@ | |||
|
|||
ALL_VISITOR_CLS = [ | |||
TorchDeprecatedSymbolsVisitor, |
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.
Any ideas how to avoid this ugly duplication of all visitors?
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.
Yes, we can automatically pick them up with a registry pattern. Already got something in progress for this.
b = torch.log(1 + a) | ||
c = torch.log(a + 1) | ||
b = torch.log(1.0 + a) | ||
c = torch.log(a + 1.0) |
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.
Could we already add Array API examples here? We don't have the capability of automatically detecting them at the moment, but it's good to be explicit about the known false negatives, especially when we can catch them later
import torch
a = torch.randn(5)
print((a + 1).log())
print(a.log1p())
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.
Added a false negative.
Nice catch, LGTM |
Let's also add pytorch/botorch#2541 / pytorch/botorch#2540 in a follow-up |
I'll add |
Suggest using
torch.log1p(x)
instead oftorch.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