-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Relay][Frontend][Torch] fix a typo mistake in nonzero_numpy #16390
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
Conversation
0c20c01 to
10926f8
Compare
|
@junrushao @t-vi Do you think this change is appropriate? Can you help me review it? |
|
|
||
| def nonzero_numpy(self, inputs, input_types): | ||
| return self.nonzero(inputs, input_types, is_numpy_style=False) | ||
| return self.nonzero(inputs, input_types, is_numpy_style=True) |
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.
Great catch!
| """Module that performs nonzero""" | ||
|
|
||
| def __init__(self): | ||
| super().__init__() |
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.
You don't actually need this init, and in the test also the docstring.
Also I'd probably make the class definition local to the test to have it all in one place.
| import_input = [("input0", (2, 10)), ("input1", (2, 10))] | ||
| relay_model_ir, relay_model_params = tvm.relay.frontend.from_pytorch( | ||
| traced_torch_model, import_input | ||
| ) |
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.
I'd prefer the test to go in one of the other files (e.g. test_forward.py).
Also, I think it might be best to add a check that PyTorch and TVM actually give the same result (like the other tests in test_forward.py).
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.
ok
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.
I see there is a test "test_forward_nonzero" (test_forward.py:4435). added a line there
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.
Thank you,
t-vi
left a comment
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.
Thank you for the fix, I think there might be improvements to the testing.
10926f8 to
c3e5663
Compare
t-vi
left a comment
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.
Great! Thank you, @taomiao !
nonzero_numpy is not working correctly #16389