Skip to content

feat: add pytorch frontend index_reduce#23016

Merged
nassimberrada merged 9 commits intounifyai:mainfrom
tsdocode:fe-torch-index_reduce
Sep 22, 2023
Merged

feat: add pytorch frontend index_reduce#23016
nassimberrada merged 9 commits intounifyai:mainfrom
tsdocode:fe-torch-index_reduce

Conversation

@tsdocode
Copy link
Copy Markdown
Contributor

@tsdocode tsdocode commented Sep 4, 2023

PR Description

Related Issue

Close #22971

Checklist

  • Did you add a function?
  • Did you add the tests?
  • Did you follow the steps we provided?

Socials:

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 4, 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 main, 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! 🎉👨‍💻

@ivy-leaves ivy-leaves added the PyTorch Frontend Developing the PyTorch Frontend, checklist triggered by commenting add_frontend_checklist label Sep 4, 2023
@tsdocode
Copy link
Copy Markdown
Contributor Author

tsdocode commented Sep 4, 2023

@D0m-inic I found New Failures Introduced do not belong to this PR, should we fix them in this PR?

New Failures Introduced:

ivy_tests/test_ivy/test_frontends/test_torch/test_indexing_slicing_joining_mutating_ops.py::test_torch_index_copy,torch
ivy_tests/test_ivy/test_frontends/test_torch/test_indexing_slicing_joining_mutating_ops.py::test_torch_index_copy,paddle
ivy_tests/test_ivy/test_frontends/test_torch/test_indexing_slicing_joining_mutating_ops.py::test_torch_masked_select,numpy
ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py::test_torch_tensor_var,numpy
ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py::test_torch_tensor_index_select,jax
ivy_tests/test_ivy/test_frontends/test_torch/test_indexing_slicing_joining_mutating_ops.py::test_torch_argwhere,tensorflow
ivy_tests/test_ivy/test_frontends/test_torch/test_indexing_slicing_joining_mutating_ops.py::test_torch_index_add,torch
ivy_tests/test_ivy/test_frontends/test_torch/test_indexing_slicing_joining_mutating_ops.py::test_torch_index_add,paddle
ivy_tests/test_ivy/test_frontends/test_torch/test_indexing_slicing_joining_mutating_ops.py::test_torch_index_select,jax
ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py::test_torch_tensor_view,tensorflow

@D0m-inic
Copy link
Copy Markdown
Contributor

Hi, I see you've changed some other parts of the code not including your test and implementation that are most likely introducing these new failures, could you revert these?

@tsdocode
Copy link
Copy Markdown
Contributor Author

tsdocode commented Sep 12, 2023

@D0m-inic I have checked these errors. One came from my miss typing (numberic instead of numeric). After test again, the New Failures Introduced reduce to:

ivy_tests/test_ivy/test_frontends/test_torch/test_indexing_slicing_joining_mutating_ops.py::test_torch_masked_select,numpy
ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py::test_torch_tensor_index_select,jax
ivy_tests/test_ivy/test_frontends/test_torch/test_indexing_slicing_joining_mutating_ops.py::test_torch_index_select,paddle
ivy_tests/test_ivy/test_frontends/test_torch/test_indexing_slicing_joining_mutating_ops.py::test_torch_index_select,jax
ivy_tests/test_ivy/test_frontends/test_torch/test_indexing_slicing_joining_mutating_ops.py::test_torch_index_add,paddle

But I think the others not belong to my code. Such as:

  • E ivy.utils.exceptions.IvyException: Cannot convert to ivy dtype. uint64 is not supported by PyTorch backend.

This error likely belong to the backend. I have check in the Pytorch documents https://pytorch.org/docs/stable/tensors.html#id5. Torch currently do not support uint16, uint32, uint64, bfloat32, bfloat64 and paddle currently not support bfloat16

Does Ivy add new support dtypes that Pytorch do not support? If yes maybe we need to check the helper.get_dtypes method to produce correct dtype.

@tsdocode
Copy link
Copy Markdown
Contributor Author

tsdocode commented Sep 12, 2023

I have run the same test on branch main locally, then I got the same failed error.
Screen Shot 2023-09-13 at 00 24 44

@ivy-seed ivy-seed assigned nassimberrada and unassigned D0m-inic Sep 17, 2023
@nassimberrada
Copy link
Copy Markdown
Contributor

Hi @tsdocode, thank you for your contribution, I'll be taking over for reviewing. I see that most introduced failures come from the sameindexing_slicing_joining_mutating_ops module, this would probably be due to the fact that you've made changes to the input generation helper function _dtype_input_idx_axis that these functions use in their tests. I suggest you keep that function as is and make necessary modifications directly within your function's testing procedure. You are welcome to make another helper function separate from the existing one as well. Thank!

@tsdocode
Copy link
Copy Markdown
Contributor Author

@nassimberrada, thanks for your feedback. I did reverted the _arrays_dim_idx_n_dtypes and create an extend one.
Screen Shot 2023-09-17 at 22 22 35
Test is OK in local but maybe testing pipeline on github action is under strange error:

ImportError while loading conftest '/ivy/ivy_tests/test_ivy/conftest.py'.
ivy_tests/test_ivy/conftest.py:33: in <module>
    import ivy_t

ests.test_ivy.helpers.test_parameter_flags as pf
ivy_tests/test_ivy/helpers/__init__.py:2: in <module>
    from . import hypothesis_helpers
ivy_tests/test_ivy/helpers/hypothesis_helpers/__init__.py:1: in <module>
    from . import general_helpers
ivy_tests/test_ivy/helpers/hypothesis_helpers/general_helpers.py:8: in <module>
    import ivy
ivy/__init__.py:792: in <module>
    from . import stateful
ivy/stateful/__init__.py:1: in <module>
    from . import activations
ivy/stateful/activations.py:5: in <module>
    from ivy.stateful.module import Module
ivy/stateful/module.py:9: in <module>
    import dill
E   ModuleNotFoundError: No module named 'dill'

@nassimberrada
Copy link
Copy Markdown
Contributor

Hey, thanks for making those changes. Just a question, is your branch up-to-date with main ? This issue was encountered elsewhere and should be fixed on the latest updates. Let me know if this persists otherwise, thanks!

@tsdocode
Copy link
Copy Markdown
Contributor Author

Of course code is up-to-date with main. I think there is some problem with intelligent-test-pr job of Ivy repo. Other PR is also failed by this error.

@tsdocode
Copy link
Copy Markdown
Contributor Author

I have touch the CI team to check the auto-test issue, maybe we must wait until Docker issues is solved
Screen Shot 2023-09-19 at 12 00 44

@nassimberrada
Copy link
Copy Markdown
Contributor

Yes I've been waiting for them to come back to me on this issue, but thanks for flagging it on your side as well. Let's wait for a fix then we can get your PR merged if everything's clear.

@tsdocode
Copy link
Copy Markdown
Contributor Author

tsdocode commented Sep 22, 2023

@nassimberrada the test error in auto test is fixed, I also re-run the test and there no new failures introduce.

@nassimberrada
Copy link
Copy Markdown
Contributor

Looks good to me, great work! Merging, thank your for your patience and for your contribution!

@nassimberrada nassimberrada merged commit 6a004a7 into unifyai:main Sep 22, 2023
iababio pushed a commit to iababio/ivy that referenced this pull request Sep 27, 2023
druvdub pushed a commit to druvdub/ivy that referenced this pull request Oct 14, 2023
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

index_reduce

4 participants