-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
frontends.torch.Tensor: add matmul instance method #6935
Changes from 3 commits
5c6c124
42b9c9f
d0a281e
61e8588
d023dae
1264534
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 |
---|---|---|
|
@@ -6,6 +6,11 @@ | |
|
||
# local | ||
import ivy_tests.test_ivy.helpers as helpers | ||
from ivy_tests.test_ivy.helpers import handle_cmd_line_args | ||
from ivy_tests.test_ivy.test_frontends.test_torch.test_blas_and_lapack_ops import ( | ||
_get_dtype_and_3dbatch_matrices, | ||
_get_dtype_input_and_matrices, | ||
) | ||
from ivy_tests.test_ivy.helpers import handle_frontend_method | ||
|
||
|
||
|
@@ -2558,3 +2563,43 @@ def test_torch_instance_pow_(dtype_and_x, as_variable, native_array): | |
class_name="tensor", | ||
method_name="pow_", | ||
) | ||
|
||
|
||
@st.composite | ||
def _get_dtype_and_multiplicative_matrices(draw): | ||
return draw( | ||
st.one_of( | ||
_get_dtype_input_and_matrices(), | ||
_get_dtype_and_3dbatch_matrices(), | ||
) | ||
) | ||
|
||
|
||
# matmul | ||
@handle_cmd_line_args | ||
@given( | ||
dtype_tensor1_tensor2=_get_dtype_and_multiplicative_matrices(), | ||
) | ||
def test_torch_instance_matmul( | ||
dtype_tensor1_tensor2, | ||
as_variable, | ||
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. where are 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
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 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. Hi @hmahmood24, indeed you're correct, my apologies, I haven't been working on the frontends so I'm a little behind with some of the strategies updates. As for the the assertion error, perhaps try adjusting the |
||
native_array, | ||
): | ||
dtype, tensor1, tensor2 = dtype_tensor1_tensor2 | ||
helpers.test_frontend_method( | ||
input_dtypes_init=dtype, | ||
as_variable_flags_init=as_variable, | ||
num_positional_args_init=1, | ||
native_array_flags_init=native_array, | ||
all_as_kwargs_np_init={ | ||
"data": tensor1, | ||
}, | ||
input_dtypes_method=dtype, | ||
as_variable_flags_method=as_variable, | ||
num_positional_args_method=1, | ||
native_array_flags_method=native_array, | ||
all_as_kwargs_np_method={"tensor2": tensor2}, | ||
frontend="torch", | ||
class_name="tensor", | ||
method_name="matmul", | ||
) |
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.
we now have 4 new decorators instead of
handle_cmd_line_args
:handle_function
: used for Ivy functional APIhandle_method
: used for Ivy methodshandle_frontend_function
: used for frontend functionshandle_frontend_method
: used for frontend methods, methods tests are now skipped temporarily.The last decorator is the one you'll need to replace
handle_cmd_line_args
with. Unfortunately, this is the only one currently not functioning correctly, but it will be rectified soon!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.
@hmahmood24 perhaps you didn't see this update?
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.
@simonetgordon,
Apologies I wasn't able to reply earlier. I have seen the updates and I have also refactored my tests in coherence with these updates but to no avail. The
test_tensor.py
file has still so many bugs that prevents the tests from getting collected. At this point, I'm not sure what's the best course of action for me apart from just waiting this out.Have you asked anyone from the team to look into these bugs by now?
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.
@hmahmood24 Hi there, yes someone is trying to tackle these but there should have already been some fixes pushed.
Also, I don't see the new decorator here in the PR version. Perhaps you forgot to push?
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.
@simonetgordon Hey, yes I didn't push my changes since the tests weren't collecting locally. I have made the changes and pushed them to remain coherent with all the other tests now.
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.
Hi @simonetgordon,
Any updates since it’s been almost 2 weeks since this PR got opened? Anything from my end to add here?