-
Notifications
You must be signed in to change notification settings - Fork 20
Add check for second value in sum: Logsumexp #90
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
Changes from 6 commits
a254c04
ca6853c
8a28ec0
beca6d7
3637b27
0db07d1
cf8e693
e0ee6ff
0c2edab
708eee4
2762520
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
6:5 TOR108 Use numerically stabilized `torch.logsumexp`. | ||
7:5 TOR108 Use numerically stabilized `torch.logsumexp`. | ||
8:5 TOR108 Use numerically stabilized `torch.logsumexp`. | ||
9:5 TOR108 Use numerically stabilized `torch.logsumexp`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -184,9 +184,18 @@ def visit_Call(self, node): | |
) | ||
== "torch.exp" | ||
): | ||
self.add_violation( | ||
node, | ||
error_code=self.ERRORS[0].error_code, | ||
message=self.ERRORS[0].message(), | ||
replacement=None, | ||
) | ||
if self.get_specific_arg( | ||
shivam096 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
node.args[0].value, arg_name="dim", arg_pos=1 | ||
): | ||
if ( | ||
self.get_specific_arg( | ||
node.args[0].value, arg_name="dim", arg_pos=1 | ||
).value.value | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You only check for value of the argument when it's present. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The first "if" condition on line 187 checks for the presence of "dim" and then if confirmed it is moved to the second "if" in line 190. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see now. https://github.com/pytorch-labs/torchfix/actions/runs/13081681874/job/36506448560?pr=90 See this for example https://github.com/pytorch-labs/torchfix/blob/main/torchfix/visitors/deprecated_symbols/__init__.py#L35 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may also need to use Please run mypy locally and verify it passes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ran the code and mypy errors are only resolved when I do a And in doing so I need to check for both And since value of tuple cannot be retrieved through There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have updated the code and have made the necessary changes to handle any future type based issues. Updated the test cases as well |
||
!= "None" | ||
): | ||
self.add_violation( | ||
node, | ||
error_code=self.ERRORS[0].error_code, | ||
message=self.ERRORS[0].message(), | ||
replacement=None, | ||
) |
Uh oh!
There was an error while loading. Please reload this page.