Skip to content
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

added numpy instance method put #14682

Closed
wants to merge 3 commits into from

Conversation

AnjelicaB
Copy link

Close #14680

@ivy-leaves ivy-leaves added the NumPy Frontend Developing the NumPy Frontend, checklist triggered by commenting add_frontend_checklist label Apr 28, 2023
@xoiga123
Copy link
Contributor

Hi, thanks for contributing to Ivy 🤗 Apart from the frontend implementation, can you also implement the accompanying frontend test like described in the Open Tasks Guide? Thank you 🤗

@xoiga123
Copy link
Contributor

@AnjelicaB LGTM, however please comment add_frontend_checklist and edit the checklist first, thank you! 🙏

@AnjelicaB
Copy link
Author

@AnjelicaB LGTM, however please comment add_frontend_checklist and edit the checklist first, thank you! 🙏

Hi! I'm not sure what you mean by editing the checklist. Do you mean this checklist (#3607)? I already opened an issue on it. There are also some tests that failed. What could have been the bug that caused these failures?

@xoiga123
Copy link
Contributor

Ah the docs for add_frontend_checklist hasn't been added yet, sorry for the confusion. For now, please comment as add_frontend_checklist only and follow the instructions in this section of the open tasks guide. It will help me know if you're stuck somewhere or what tests are failing too. Thank you 🤗

@AnjelicaB
Copy link
Author

AnjelicaB commented Jun 2, 2023

Frontend Task Checklist

IMPORTANT NOTICE 🚨:

The Ivy Docs represent the ground truth for the task descriptions and this checklist should only be used as a supplementary item to aid with the review process.

LEGEND 🗺:

  • ❌ : Check item is not completed.
  • ✅ : Check item is ready for review.
  • 🆘 : Stuck/Doubting implementation (PR author should add comments explaining why).
  • ⏩ : Check is not applicable to function (skip).
  • 🆗 : Check item is implemented and does not require any edits.

CHECKS 📑:

    • ✅ : The function/method definition is not missing any of the original arguments.
    • ⏩: In case the function/method to be implemented is an alias of an existing function/method:
        • ⏩: It is being declared as such by setting fun1 = fun2, rather than being re-implemented from scratch.
        • ⏩: The alias is added to the existing function/method's test in the aliases parameter of handle_frontend_test/handle_frontend_method.
    • ✅: The naming of the function/method and its arguments exactly matches the original.
    • ✅: No defined argument is being ignored in the function/method's implementation.
    • ⏩: In special cases where an argument's implementation should be pending due to an incomplete superset of an ivy function:
        • ⏩: A ToDo comment has been added prompting to pass the frontend argument to the ivy function whose behavior is to be extended.
    • ⏩: In case a frontend function is being added:
        • ⏩: It is a composition of ivy functions.
        • ⏩: In case the needed composition is long (using numerous ivy functions), a Missing Function Suggestion issue has been opened to suggest a new ivy function should be added to shorten the frontend implementation.
        • ⏩: @to_ivy_arrays_and_back has been added to the function.
    • ⏩: In case a frontend method is being added:
        • ⏩: It is composed of existing frontend functions or methods.
        • ⏩: If a required frontend function has not yet been added, the method may be implemented as a composition of ivy functions, making sure that:
          • ⏩: @to_ivy_arrays_and_back has been added to the method.
          • ⏩: A ToDo comment has been made prompting to remove the decorator and update the implementation as soon as the missing function has been added.
    • ❌: The function/method's test has been added (except in the alias case mentioned in <2>):
        • ✅: All supported arguments are being generated in handle_frontend_test/handle_frontend_method and passed to test_frontend_function/test_frontend_method.
        • 🆘: The argument generation covers all possible supported values. Array sizes, dimensions, and axes adhere to the full supported set of the original function/method. (How can I check if my method supports all of this?)
        • ✅: The available_dtypes parameter passed to the helper generating the function/method's input array is set to helpers.get_dtypes("valid"). If there are unsupported dtypes that cause the test to fail, they should be handled by adding @with_supported_dtypes/@with_unsupported_dtype to the function/method.
    • 🆘: The PR is not introducing any test failures. (The checks are not all passing, what should I change about my code?)
        • ❌: The lint checks are passing.
        • ❌: The implemented test is passing for all backends.
    • 🆘: The PR closes a Sub Task issue linked to one of the open frontend ToDo lists. (Where do I check if the PR closes its related subtask?)
    • ✅: The function/method and its test have been added to the correct .py files corresponding to the addressed ToDo list.
    • ✅: The PR only contains changes relevant to the addressed subtask.

@AnjelicaB
Copy link
Author

Hello! Could you help me with some of the "SOS" in the checklist? The tests that are failing include:
intelligent-tests-pr/run-tests 1, 2, 3, 4, 7, 8, 9, 11, 13, 14, 15, 17, 19, 21, 27, 32, 33, 38, 45, 50, 52, 55, 60, 61, 63,
and lint/check-formatting

Copy link
Contributor

@xoiga123 xoiga123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @AnjelicaB, sorry I took a long time to reply. I need you to make some changes here, thank you 🤗

@@ -345,6 +345,9 @@ def tolist(self) -> list:
def view(self):
return np_frontend.reshape(self, tuple(self.shape))

def put(a, ind, v, mode="raise"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are adding an instance method, which means the function definition must have a self argument in order to be used as an instance method, something along the lines of

def put(self, ind, v, mode='raise')

@@ -345,6 +345,9 @@ def tolist(self) -> list:
def view(self):
return np_frontend.reshape(self, tuple(self.shape))

def put(a, ind, v, mode="raise"):
return np_frontend.put(a, ind, v, mode="raise")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are attempting to call a frontend method, which is np_frontend.put. However, this function hasn't been implemented yet in the codebase. Now you either have 2 choices:

  1. Implement it yourself by creating another PR with this issue Add Matrix methods for Numpy Frontend #1535, which means you'll have to implement ivy.functional.frontends.numpy.put first.
  2. Put this PR on hold and wait for someone to implement said function first.

method_input_dtypes=input_dtypes,
init_all_as_kwargs_np={"object": x[0]},
method_all_as_kwargs_np={"value": x[1:]},

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing an enclosing bracket ), which makes the file syntactically wrong and makes the tests fail.

@ivy-seed ivy-seed added the Stale label Jun 21, 2023
@ivy-seed
Copy link

This PR has been labelled as stale because it has been inactive for more than 7 days. If you would like to continue working on this PR, then please add another comment or this PR will be closed in 7 days.

@ivy-seed ivy-seed closed this Jul 1, 2023
@ivy-seed
Copy link

ivy-seed commented Jul 1, 2023

This PR has been closed because it has been marked as stale for more than 7 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NumPy Frontend Developing the NumPy Frontend, checklist triggered by commenting add_frontend_checklist Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

put
4 participants