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: manual dtype casting removal #22700

Merged
merged 54 commits into from
Nov 3, 2023
Merged

feat: manual dtype casting removal #22700

merged 54 commits into from
Nov 3, 2023

Conversation

Madjid-CH
Copy link
Contributor

@Madjid-CH Madjid-CH commented Aug 28, 2023

PR Description

This PR is for this task

I started with the Paddle backend. I need some feedback on my work so I can continue with the other backends.

@github-actions
Copy link
Contributor

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 PaddlePaddle Backend Developing the Paddle Paddle Backend. label Aug 28, 2023
@ivy-leaves
Copy link

If you are working on an open task, please edit the PR description to link to the issue you've created.

For more information, please check ToDo List Issues Guide.

Thank you 🤗

Copy link
Contributor

@vedpatwardhan vedpatwardhan left a comment

Choose a reason for hiding this comment

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

Hey @Madjid-CH, thanks for looking into this, just requested a couple of changes, but they also apply to all the other functions if applicable 😄

@with_unsupported_device_and_dtypes(
{"2.5.1 and below": {"cpu": ("bfloat16",)}}, backend_version
@with_supported_dtypes(
{"2.5.1 and below": ("float16", "uint16", "float32", "float64", "complex")},
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of float16, float32 and float64 you could just use float, as all float dtypes are supported.
Also, I think uint16 isn't supported in paddle
Same applies to other similar instances in the paddle backend

Copy link
Contributor Author

@Madjid-CH Madjid-CH Aug 29, 2023

Choose a reason for hiding this comment

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

Actually I looked into the functions source code to figure out the supported types, for example: here I think is where the supported types checks is performed and uint16 is mentioned.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah it seems like they might've started supporting uint16 in the later versions, @MahmoudAshraf97 what do you think? Thanks!

ivy/functional/backends/paddle/data_type.py Show resolved Hide resolved
@Madjid-CH
Copy link
Contributor Author

Hi @vedpatwardhan and @Madjid-CH , please note that some of the manual casting found in this PR is not aimed at adding support for unsupported dtypes and hence should be left in place because it has other functionality (ensuring consistency for between backends for example), most of the manual casting to add extra support is only found in paddle backend

these 2 commits should be reverted and reviewed first: 282bffc cfcfbea

understood

@Madjid-CH
Copy link
Contributor Author

Hi @vedpatwardhan and @Madjid-CH , please note that some of the manual casting found in this PR is not aimed at adding support for unsupported dtypes and hence should be left in place because it has other functionality (ensuring consistency for between backends for example), most of the manual casting to add extra support is only found in paddle backend
these 2 commits should be reverted and reviewed first: 282bffc cfcfbea

understood

@MahmoudAshraf97 can you please explain how to differentiate between a manual cast for adding support and a manual cast for backends compatibility because my approach is to test the real backend function against all available dtypes and see which dtypes behave correctly (same input same ouput dtype, not throwing error, ...)

@MahmoudAshraf97
Copy link
Contributor

Hi @vedpatwardhan and @Madjid-CH , please note that some of the manual casting found in this PR is not aimed at adding support for unsupported dtypes and hence should be left in place because it has other functionality (ensuring consistency for between backends for example), most of the manual casting to add extra support is only found in paddle backend
these 2 commits should be reverted and reviewed first: 282bffc cfcfbea

understood

@MahmoudAshraf97 can you please explain how to differentiate between a manual cast for adding support and a manual cast for backends compatibility because my approach is to test the real backend function against all available dtypes and see which dtypes behave correctly (same input same ouput dtype, not throwing error, ...)

there is no solid diffrentiation between the two types, but as I said the casting for compatibility is mostly found in paddle backend

@vedpatwardhan
Copy link
Contributor

Hi @vedpatwardhan and @Madjid-CH , please note that some of the manual casting found in this PR is not aimed at adding support for unsupported dtypes and hence should be left in place because it has other functionality (ensuring consistency for between backends for example), most of the manual casting to add extra support is only found in paddle backend

these 2 commits should be reverted and reviewed first: 282bffc cfcfbea

Yeah you're right! There are cases where we apply casting to the output to ensure consistency, could you please share some examples in those commits where this is being done? Thanks @MahmoudAshraf97 😄

Copy link
Contributor

@vedpatwardhan vedpatwardhan left a comment

Choose a reason for hiding this comment

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

Hey @Madjid-CH, could you please check through if there's any unresolved conversations in the previous reviews as well? Thanks 😄

@Madjid-CH
Copy link
Contributor Author

Hey @Madjid-CH, could you please check through if there's any unresolved conversations in the previous reviews as well? Thanks 😄

sure Ved 😃

Copy link
Contributor

@vedpatwardhan vedpatwardhan left a comment

Choose a reason for hiding this comment

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

lgtm! Let's wait for @MahmoudAshraf97 to give it another look, thanks @Madjid-CH 😄

@vedpatwardhan
Copy link
Contributor

vedpatwardhan commented Sep 21, 2023

ivy-gardener
✅ Ivy gardener has formatted your code.
If changes are requested, don't forget to pull your fork.

Copy link
Contributor

@MahmoudAshraf97 MahmoudAshraf97 left a comment

Choose a reason for hiding this comment

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

LGTM, you should keep the dtypes decorator as is because cpu and gpu support are different in paddle

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

Thank you for your Pull Request! We have run several checks on this pull request in order to make sure it's suitable for merging into this project. The results are listed in the following section.

Issue Reference

In order to be considered for merging, the pull request description must refer to a specific issue number. This is described in our contributing guide and our PR template.
This check is looking for a phrase similar to: "Fixes #XYZ" or "Resolves #XYZ" where XYZ is the issue number that this PR is meant to address.

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

Thank you for your Pull Request! We have run several checks on this pull request in order to make sure it's suitable for merging into this project. The results are listed in the following section.

Issue Reference

In order to be considered for merging, the pull request description must refer to a specific issue number. This is described in our contributing guide and our PR template.
This check is looking for a phrase similar to: "Fixes #XYZ" or "Resolves #XYZ" where XYZ is the issue number that this PR is meant to address.

@Madjid-CH
Copy link
Contributor Author

LGTM, you should keep the dtypes decorator as is because cpu and gpu support are different in paddle

understood

…g-removal

# Conflicts:
#	ivy/functional/backends/paddle/elementwise.py
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

Thank you for your Pull Request! We have run several checks on this pull request in order to make sure it's suitable for merging into this project. The results are listed in the following section.

Issue Reference

In order to be considered for merging, the pull request description must refer to a specific issue number. This is described in our contributing guide and our PR template.
This check is looking for a phrase similar to: "Fixes #XYZ" or "Resolves #XYZ" where XYZ is the issue number that this PR is meant to address.

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

Thank you for your Pull Request! We have run several checks on this pull request in order to make sure it's suitable for merging into this project. The results are listed in the following section.

Issue Reference

In order to be considered for merging, the pull request description must refer to a specific issue number. This is described in our contributing guide and our PR template.
This check is looking for a phrase similar to: "Fixes #XYZ" or "Resolves #XYZ" where XYZ is the issue number that this PR is meant to address.

@ivy-leaves ivy-leaves added the PyTorch Frontend Developing the PyTorch Frontend, checklist triggered by commenting add_frontend_checklist label Oct 9, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2023

Thank you for this PR, here is the CI results:


This pull request does not result in any additional test failures. Congratulations!

@vedpatwardhan
Copy link
Contributor

Hey @MahmoudAshraf97, could you please review this PR so that we can get it merged soon? Thanks 😄

Madjid Chergui added 2 commits November 3, 2023 10:24
…g-removal

# Conflicts:
#	ivy/functional/backends/paddle/activations.py
#	ivy/functional/backends/paddle/elementwise.py
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

Thank you for your Pull Request! We have run several checks on this pull request in order to make sure it's suitable for merging into this project. The results are listed in the following section.

Issue Reference

In order to be considered for merging, the pull request description must refer to a specific issue number. This is described in our contributing guide and our PR template.
This check is looking for a phrase similar to: "Fixes #XYZ" or "Resolves #XYZ" where XYZ is the issue number that this PR is meant to address.

@Madjid-CH Madjid-CH merged commit 2def0c8 into ivy-llc:main Nov 3, 2023
51 of 95 checks passed
@Madjid-CH Madjid-CH deleted the manual-dtype-casting-removal branch November 3, 2023 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ivy Functional API PaddlePaddle Backend Developing the Paddle Paddle Backend. 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.

7 participants