-
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
add torch.meshgrid to torch frontend #11560
Conversation
Hi Ahmed! thanks again for your contribution to ivy! as the tests appear to be failing, i'll add a few comments that hopefully help:) |
@@ -35,6 +35,11 @@ def roll(input, shifts, dims=None): | |||
return ivy.roll(input, shifts, axis=dims) | |||
|
|||
|
|||
@to_ivy_arrays_and_back | |||
def meshgrid(*tensors, indexing=None): | |||
return ivy.meshgrid(*tensors, indexing=indexing) |
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.
torch's meshgrid returns a tuple so cast the output to a tuple instead of a list, (this also fixes the type issues and output length issues)
test_flags, | ||
): | ||
dtypes, tensors = dtypes_and_tensors | ||
if isinstance(dtypes, list): |
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.
the if else statement here is actually not needed as the output is always a list, also no need to cast the output to a numpy array, it is already one, no need to cast the type either, just keep it as kwargs = { f"tensor{i}": tensor for i, tensor in enumerate(tensors) }
else: | ||
args = {"tensor": np.array(tensors, dtype=dtypes)} | ||
kwargs['indexing'] = indexing | ||
test_flags.num_positional_args = len(tensors) + 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.
there is no need for the +1
in line 174, len(tensor)
should be enough
Hopefully, everything will run with no errors after these little tweaks, and we should be good to merge! |
thank you so much, Yasser, I will try these changes asap in a different PR, this branch got some problems for me |
No worries! see you there! |
close #11227