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

feat: add cpu function #21255

Closed
wants to merge 29 commits into from
Closed

feat: add cpu function #21255

wants to merge 29 commits into from

Conversation

Prajyot70
Copy link

@Prajyot70 Prajyot70 commented Aug 3, 2023

close #21086

@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2023

Thanks for contributing to Ivy! 😊👏
Here are some of the important points from our Contributing Guidelines 📝:
1. Feel free to ignore the run_tests (1), run_tests (2), … jobs, and only look at the display_test_results job. 👀 It contains the following two sections:
- Combined Test Results: This shows the results of all the ivy tests that ran on the PR. ✔️
- New Failures Introduced: This lists the tests that are passing on master, but fail on the PR Fork. Please try to make sure that there are no such tests. 💪
2. The lint / Check formatting / check-formatting tests check for the formatting of your code. 📜 If it fails, please check the exact error message in the logs and fix the same. ⚠️🔧
3. Finally, the test-docstrings / run-docstring-tests check for the changes made in docstrings of the functions. This may be skipped, as well. 📚
Happy coding! 🎉👨‍💻

@a0m0rajab
Copy link
Contributor

Hi Thank you for your effort, since this is a frontend function, you need to implement it in the frontend folder and add the related tests, to do that you need to read the documentation or check other examples,

The related docs:
https://unify.ai/docs/ivy/overview/contributing.html
https://unify.ai/docs/ivy/overview/contributing.html

@a0m0rajab a0m0rajab mentioned this pull request Aug 4, 2023
@Prajyot70
Copy link
Author

Hi Thank you for your effort, since this is a frontend function, you need to implement it in the frontend folder and add the related tests, to do that you need to read the documentation or check other examples,

The related docs:
https://unify.ai/docs/ivy/overview/contributing.html
https://unify.ai/docs/ivy/overview/contributing.html

Hello,
Thank you for your review!
I have made the required changes as stated by you. please have a look at them and if there are any mistakes or corrections needed please let me know.
Thank You!

@ivy-leaves ivy-leaves added the PyTorch Frontend Developing the PyTorch Frontend, checklist triggered by commenting add_frontend_checklist label Aug 10, 2023
Copy link
Contributor

@a0m0rajab a0m0rajab left a comment

Choose a reason for hiding this comment

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

Thanks for adding the tests, but can you check the implementation of the function again? the location is not correct and you need to follow the examples in the guide it will direct you.

@Prajyot70
Copy link
Author

Thanks for adding the tests, but can you check the implementation of the function again? the location is not correct and you need to follow the examples in the guide it will direct you.

Hello,
Thank you for your review!
I figured out the correct location for both the function and the test this time but when i try to make changes in the place it shows the following error, even though I'm trying to make changes in my forked repository.
There was a error commiting your changes: A file with the same name already exists. Please choose a different name and try again.
If i change the name then the location gets changed automatically. Do you have any potential suggestions for this issue.
Thank You!

@JPGoodale
Copy link
Contributor

Hi @Prajyot70 I believe that this function should be added to the tensor file in the torch frontend and the test to the corresponding test_tensor one. Also the @to_ivy_arrays_and_back decorator is currently at the top of the file rather than just above the function which it is decorating and you still have a call of your function and print statement of its result at the bottom of the file which should be removed before pushing.

@Prajyot70
Copy link
Author

Hi @Prajyot70 I believe that this function should be added to the tensor file in the torch frontend and the test to the corresponding test_tensor one. Also the @to_ivy_arrays_and_back decorator is currently at the top of the file rather than just above the function which it is decorating and you still have a call of your function and print statement of its result at the bottom of the file which should be removed before pushing.

Hello,
Thank you for your review and suggestions it helped a lot!
I have made the required changes as stated by you. please have a look at them
Thank You!

@JPGoodale
Copy link
Contributor

Hi @Prajyot70, glad I could help. It looks like the to_cpu method which you are trying to call has yet to have been implemented, maybe try using ivy.to_device. Also there a few spelling issues and missing fields in your test function, please take a look at these as they will of course cause your tests to fail even if the function itself is correct.

@Prajyot70
Copy link
Author

Prajyot70 commented Sep 9, 2023

Hi @Prajyot70, glad I could help. It looks like the to_cpu method which you are trying to call has yet to have been implemented, maybe try using ivy.to_device. Also there a few spelling issues and missing fields in your test function, please take a look at these as they will of course cause your tests to fail even if the function itself is correct.

Hello,
I've made the following changes in the pull request,

  • Changed method from 'to_cpu' to 'ivy.to_device'
  • Made changes in test according to function
  • Corrected the spelling issues and missing feilds in the tests

Please have a look at them and let me know your insights.
Thank You!

@Prajyot70
Copy link
Author

Prajyot70 commented Sep 21, 2023

Hello,
I've made the following changes in the pull request,

  • Changed method from 'to_cpu' to 'ivy.to_device'
  • Made changes in test according to function
  • Corrected the spelling issues and missing feilds in the tests

Please have a look at them and let me know your insights.
Thank You!

Hello @JPGoodale ,
This is just a kind reminder to bring your attention to the quoted message which explains the changes made in the PR according to your suggestions and ivy's contribution guidelines.
Please have a look at it and let me know your insights.
Thank You!

@JPGoodale JPGoodale assigned NripeshN and unassigned JPGoodale Dec 3, 2023
@NripeshN
Copy link
Contributor

NripeshN commented Dec 4, 2023

Hey @Prajyot70,
Could you please solve the merge conflicts.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

PR Compliance Checks Passed!

@Prajyot70 Prajyot70 changed the title cpu pytorch frontend feat: add cpu function Dec 12, 2023
@Prajyot70
Copy link
Author

Hello @NripeshN ,
At last only one test was failing, that is because of the inappropriate PR title. Now i have updated the PR title as specified by conventional commits organization.
Please have a look.
Thank You!

@Prajyot70
Copy link
Author

Hello @NripeshN ,
This is a kind reminder to please review the PR. Github actions bot has commented as checks passed.
Thank You!

@NripeshN
Copy link
Contributor

NripeshN commented Dec 19, 2023

Hey @Prajyot70
Could you please solve the merge conflicts. You can do this by merging with upsteam

@Prajyot70 Prajyot70 changed the title feat: add cpu function feat : add cpu function Dec 21, 2023
@Prajyot70 Prajyot70 changed the title feat : add cpu function feat: add cpu function Dec 21, 2023
@Sarvesh-Kesharwani
Copy link
Contributor

Hi @Prajyot70
Please work on the changes suggested and let me know afterwords.
Thanks

@ivy-seed ivy-seed added the Stale label Feb 8, 2024
@ivy-seed
Copy link

ivy-seed commented Feb 8, 2024

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.

@@ -633,6 +633,16 @@ def acos_(self):
self.ivy_array = self.acos().ivy_array
return self

@to_ivy_arrays_and_back
def to_cpu(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Use correct name as mentioned in open issues list here: #3612 or here in original functions here https://pytorch.org/docs/stable/generated/torch.Tensor.cpu.html#torch.Tensor.cpu.

@@ -7831,6 +7837,55 @@ def test_torch_index_select(
)


#cpu
@handle_frontend_method
class TestTorchInstanceToCPU(unittest.TestCase):(
Copy link
Contributor

Choose a reason for hiding this comment

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

why have you implemented the test in this fashion, any reason?

Copy link
Contributor

Choose a reason for hiding this comment

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

If not, stick to the way other test functions are implemented.
Thanks

Comment on lines +7885 to +7887
if __name__ == "__main__":
unittest.main()

Copy link
Contributor

Choose a reason for hiding this comment

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

I think these lines are unnecessary.

@Prajyot70
Copy link
Author

Hello @Sarvesh-Kesharwani ,
Thank you for your review & apologies for the delay.
I'll work on the changes and will inform you soon.
Thank You !

@Ishticode
Copy link
Contributor

Ishticode commented Mar 4, 2024

I am closing this as there are many issues still there pointed out by @a0m0rajab @JPGoodale @Sarvesh-Kesharwani above. The requested changes are not made, the implementation has a different name than the actual torch method and the tests are chosen to be implemented differently than other examples. Please follow our Contributing page for further details. Thanks for the efforts all

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

Successfully merging this pull request may close these issues.

cpu
9 participants