-
Notifications
You must be signed in to change notification settings - Fork 17
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 TorchLogsumexpVisitor #89
Conversation
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.
Does the README need to be updated with this new rule?
Eventually, not everything is listed anyway. It should be probably generated from the code. |
y = torch.log(torch.sum(torch.exp(x), 1, keepdim=True) + 2.5) | ||
y = torch.log(torch.sum(torch.exp(x) + 2.5, 1)) |
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.
Don't you want to provide a bit more anti-patterns to make sure you don't assume that torch.log
always have a two tested functions?
y = torch.log(torch.sum(torch.exp(x), 1, keepdim=True) + 2.5) | |
y = torch.log(torch.sum(torch.exp(x) + 2.5, 1)) | |
y = torch.log(torch.sum(torch.exp(x), 1, keepdim=True) + 2.5) | |
y = torch.log(torch.sum(torch.exp(x) + 2.5, 1)) | |
y = torch.log(1 + x) |
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 some more tests. (Not exactly torch.log(1 + x)
, as it triggers another rule for log1p
).
A bit unrelated, is there already a rule that say |
No, is it common? Should be easy to add the checkers. |
Suggest using
torch.logsumexp(x)
instead oftorch.log(torch.sum(torch.exp(x))
.https://pytorch.org/docs/stable/generated/torch.logsumexp.html