ivy
ivy copied to clipboard
split #6104
added split function
Hi! Thanks for the PR!
Mostly looks good, but there are a few things that need to be fixed before this can be merged.
- The argument names in our
numpy
frontend should match the names in the originalnumpy
function exactly. Here is a link to the docs for that original function. https://numpy.org/doc/stable/reference/generated/numpy.split.html - In your implementation, you have the line
return ivy.split(a, splits=None, axis=0)
. This looks like you've tried to set the default arguments to your implementation here, but that should be done in thedef ...
line for this function. Here's a very short and quick example of what I mean by having the default arguments in thedef
line.
def f(a=0):
return a+2
- The test should provide a value for all arguments (including all optional ones), those values should be drawn from as wide of a range as is reasonably possible (while still being valid inputs for the original
numpy
function), and the names of the arguments as written in the test should also match the names used by the originalnumpy
function. Once the missingsplits
argument has been added, and once the test passes, this should be good.
Any questions or comments please let me know!
Thanks Jamie, I will look into those points and change the model as soon as possible as I'll be busy for a while now. The deadline would be 7 days from today right?
I think that deadline is just how long until GitHub will mark a PR as stale and delete it, if you keep doing stuff for the PR (it might require comments to be posted or maybe commits count I don't really know) then it won't delete it.
Hi Jamie, I am getting an error due to some line in the torches folder. Do I have to correct it ir can I skip debugging that?
Hi! You don't need to fix the errors caused by the torch
folder, but you will need to fix the errors found in your code. The logs will tell you which file and which lines to look at. You'll also need to fix the test, as it tries to pass arguments to your function with different names than the function is expecting.
Hi Jamie, I am getting the following error in the logs: FAILED ivy_tests/test_ivy/test_frontends/test_numpy/test_manipulation_routines/test_splitting_arrays.py::test_numpy_split[cpu-ivy.functional.backends.numpy-False-False-numpy] This same error occurs 4 times with each framework i.e. NumPy, torch, TensorFlow, and Jax. I can't really figure out what to correct in the code so a little guidance would be really helpful
Hi!
Sorry this is so late I've had a few very busy days at Uni. I've had a look and I've worked out what the error is, later on in the error message you get a message saying ValueError: not enough values to unpack (expected 4, got 1)
. This is because in the @given
decorator you generate a value for dtype
(which will be a dtype) and then try to unpack 4 different values out of it as if it were a collection. Add a new line to the @given
decorator for each argument you wish to generate (so one for ary
, indices_or_sections
and axis
) and add a parameter to the test function itself to accept them. You may wish to use helpers.dtype_and_values
to generate a tuple of an array and the data type of that array. This should get the test to start running. Once you get there fixing any errors should be fairly easy.
Hope this helps! Any questions or comments please let me know!
Hi! I am getting this error, is this relevant to us and if it is, how do I remove it: TypeError: 'CompositeStrategy' object is not subscriptable
Hi!
I've found a fix for the error, in the test you pass in a dtype
argument to helpers.dtype_and_values
, change that to available_dtypes=helpers.get_dtypes(...)
and it will work. The dtype
argument is expecting a pure dtype, and the available_dtypes
argument expects a strategy to generate a dtype.
Hi Jamie I am still encountering an error. Could you please help me
Hi!
What error are you getting? What is the full error text?
Also as this is a front-end function, please update your fork to the most recent version of Ivy and replace the handle_cmd_line_args
decorator with the handle_frontend_function
decorator.
Hi I cannot find any error message pertaining to my function.
Hi! Please update your fork as there have been some bugs that I believe are now fixed (I know most of them have because I fixed them but I don't know if there are some that I missed). If this doesn't fix your error, please let me know and I'll investigate.
hey Jamie! I got a mail saying that #6104 is now closed as completed from Leaves. What does that mean? Also i am getting this error now ModuleNotFoundError: No module named 'spli' but i havent imported any module like this and have also spell checked the code
Hello Aarsh! Can you please help me with this error: I got a mail saying that https://github.com/unifyai/ivy/issues/6104 is now closed as completed from Leaves. What does that mean? Also i am getting this error now ModuleNotFoundError: No module named 'spli' but i havent imported any module like this and have also spell checked the code
Hi @Aniket2002, I have re-opened the issue. It happened because you didn't use a suitable scheme to reference it when you created an issue. Will have a look into the failures asap !
Hi @Aniket2002, I have re-opened the issue. It happened because you didn't use a suitable scheme to reference it when you created an issue. Will have a look into the failures asap !
When will you be replying @Aarsh2001. I'm afraid the PR might turn stale
Hi @Aarsh2001, I am getting this error TypeError: handle_frontend_method() missing 3 required keyword-only arguments: 'class_tree', 'init_tree', and 'method_name' but i dont really have an idea about these parameters Please explain
Hey @Aniket2002, kindly have a look at the docs here
@Aniket2002 you should be drawing from hypothesis inside the decorator.
Hi @Aarsh2001, I am getting this error hypothesis.errors.InvalidArgument: Expected a SearchStrategy but got mapping['indices_or_sections_ary_axis']=<function accept.
Hey @Aniket2002, suggest you start testing the function on your local environment first, also have a look at the check suite errors under Run frontend Tests
when you click on details on the test-frontend-numpy
below. You are not using positional and keyword arguments correctly for the function. The other suggestion I'd like to make here is for you to go through the array_indices_function
docstring, and other functions where this has been used. array_dtypes
is not the only argument we should be generating. Here you'll have an idea of what precisely the positional and keyword arguments are. Lastly, I'd suggest you look at how positional and keyword arguments should be passed in functions. Thank You !