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

fix: Fix Ivy Failing Test: paddle - elementwise.multiply #28056

Merged

Conversation

sgalpha01
Copy link
Contributor

PR Description

paddle doesn't support bfloat16, that's why tests were failing.

❯ pytest ivy_tests/test_ivy/test_functional/test_core/test_elementwise.py::test_multiply --verbose
Use Database in ReadOnly Mode with local caching !
===================================================================== test session starts =====================================================================
platform linux -- Python 3.10.0, pytest-7.4.4, pluggy-1.3.0 -- /home/r0gue_shinobi/.miniconda3/envs/ivy_dev/bin/python3.10
cachedir: .pytest_cache
hypothesis profile 'ivy_profile' -> max_examples=25, print_blob=True, deadline=timedelta(milliseconds=500000), suppress_health_check=[HealthCheck.too_slow, HealthCheck.filter_too_much, HealthCheck.data_too_large], database=MultiplexedDatabase(DirectoryBasedExampleDatabase(PosixPath('/home/r0gue_shinobi/Desktop/ivy/.hypothesis/examples')), ReadOnlyDatabase(RedisExampleDatabase(Redis<ConnectionPool<Connection<host=redis-17011.c259.us-central1-2.gce.cloud.redislabs.com,port=17011,db=0>>>, expire_after=datetime.timedelta(days=8))))
metadata: {'Python': '3.10.0', 'Platform': 'Linux-6.6.6-76060606-generic-x86_64-with-glibc2.35', 'Packages': {'pytest': '7.4.4', 'pluggy': '1.3.0'}, 'Plugins': {'anyio': '4.2.0', 'hypothesis': '6.96.1', 'metadata': '3.0.0', 'json-report': '1.5.0'}}
backend(s): all
device: cpu
number of Hypothesis examples: 25
rootdir: /home/r0gue_shinobi/Desktop/ivy
plugins: anyio-4.2.0, hypothesis-6.96.1, metadata-3.0.0, json-report-1.5.0
collected 5 items                                                                                                                                             

ivy_tests/test_ivy/test_functional/test_core/test_elementwise.py::test_multiply[cpu-numpy-False-False] PASSED                                           [ 20%]
ivy_tests/test_ivy/test_functional/test_core/test_elementwise.py::test_multiply[cpu-jax-False-False] PASSED                                             [ 40%]
ivy_tests/test_ivy/test_functional/test_core/test_elementwise.py::test_multiply[cpu-tensorflow-False-False] PASSED                                      [ 60%]
ivy_tests/test_ivy/test_functional/test_core/test_elementwise.py::test_multiply[cpu-torch-False-False] PASSED                                           [ 80%]
ivy_tests/test_ivy/test_functional/test_core/test_elementwise.py::test_multiply[cpu-paddle-False-False] PASSED                                          [100%]

====================================================================== 100.0% of 5 passed ==================================================================================================

Related Issue

Closes #28055

Checklist

  • Did you add a function?
  • Did you add the tests?
  • Did you run your tests and are your tests passing?
  • Did pre-commit not fail on any check?
  • Did you follow the steps we provided?

Socials

Copy link
Contributor

@samthakur587 samthakur587 left a comment

Choose a reason for hiding this comment

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

Hii @sgalpha01 can you please remove the changes you made in importing modules.

from ivy import promote_types_of_inputs
from ivy.func_wrapper import (
with_unsupported_device_and_dtypes,
with_supported_device_and_dtypes,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
with_supported_device_and_dtypes,
with_supported_device_and_dtypes, you don't need to change this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @samthakur587, the changes are simply reordering the functions imported in ascending order, which was automatically done by black. No imports are removed or added. Please let me know if you want me to revert the imports to their initial state.

Copy link
Contributor

Choose a reason for hiding this comment

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

can you please just update your branch to latest commit. i want to check it's still coming or not. just for review. 😄

Suggested change
with_supported_device_and_dtypes,
with_supported_device_and_dtypes,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello @samthakur587, I updated my branch to the latest commit. I'll now make the required changes you requested in subsequent messages.

@samthakur587 samthakur587 self-assigned this Feb 5, 2024
"float16",
)
},
{"2.6.0 and below": ("int8", "uint8", "int16", "float16", "bfloat16")},
backend_version,
Copy link
Contributor

Choose a reason for hiding this comment

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

it's good and working fine. but i think it's looks more understandable if you add @supported_dtype(float32, float64, int32, int64 ,complex).

Copy link
Contributor

Choose a reason for hiding this comment

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

and can you please implement code for complex dtype at paddle backend.

Suggested change
backend_version,
backend_version,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding test support for bool also as it works in the main library.

>>> x = paddle.to_tensor([[True, False], [False, True]])
>>> y = paddle.to_tensor([[False, False], [True, False]])
>>> x * y
Tensor(shape=[2, 2], dtype=bool, place=Place(cpu), stop_gradient=True,
       [[False, False],
        [False, False]])

Made the changes to handle complex dtype. Please review it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hii @sgalpha01 the changes you made looking good to me. i have tested it's passing all the tests. 👍🏾

Copy link
Contributor

@samthakur587 samthakur587 left a comment

Choose a reason for hiding this comment

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

one last change and your PR ready to merge. as i have seen that you added the support of bool dtype and ivy test_case by default it uses tf as ground truth backend and tf doesn't support the bool dtype as a result the bool dtype is not tested at any backend. 😄 so you have to make some changes in test_function.

image

after making this changes check it is passing all the tests at local.

@samthakur587
Copy link
Contributor

change helper dtype to valid and ground truth to torch.

@sgalpha01
Copy link
Contributor Author

@samthakur587, I made the changes in the test file and ran the tests locally. Please review it.

Copy link
Contributor

@samthakur587 samthakur587 left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@samthakur587 samthakur587 merged commit d38a312 into ivy-llc:main Feb 8, 2024
50 of 141 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Ivy Failing Test: paddle - elementwise.multiply
4 participants