-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
#10861 : Added modf in numpy frontend #11680
Conversation
9da2a6e
to
ca2fd08
Compare
Hey, @kurshakuz can you please guide me and help in passing these checks |
Hey, @kurshakuz I have updated the code, can please review my PR. |
Close #12086 |
Hey @kurshakuz, Please review the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! Sorry for a delayed response! I have just checked your implementation and it seems to fail local tests. Can you please resolve below errors, check them locally and let me know once you are done? Thanks!
======================================================================== FAILURES =========================================================================
_____________________________________________ test_numpy_modf[cpu-ivy.functional.backends.numpy-False-False] ______________________________________________
arguments = (), kwargs = {}
@handle_frontend_test(
fn_tree="numpy.modf",
> dtypes_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("float", "int"),
),
where=np_frontend_helpers.where(),
)
E hypothesis.errors.InvalidArgument: test_numpy_modf() got an unexpected keyword argument 'dtypes_and_x', from `dtypes_and_x=dtype_and_values(available_dtypes=get_dtypes(kind='float', index='int'))` in @given
ivy_tests/test_ivy/test_frontends/test_numpy/test_mathematical_functions/test_trigonometric_functions.py:10: InvalidArgument
______________________________________________ test_numpy_modf[cpu-ivy.functional.backends.jax-False-False] _______________________________________________
arguments = (), kwargs = {}
@handle_frontend_test(
fn_tree="numpy.modf",
> dtypes_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("float", "int"),
),
where=np_frontend_helpers.where(),
)
E hypothesis.errors.InvalidArgument: test_numpy_modf() got an unexpected keyword argument 'dtypes_and_x', from `dtypes_and_x=dtype_and_values(available_dtypes=get_dtypes(kind='float', index='int'))` in @given
ivy_tests/test_ivy/test_frontends/test_numpy/test_mathematical_functions/test_trigonometric_functions.py:10: InvalidArgument
___________________________________________ test_numpy_modf[cpu-ivy.functional.backends.tensorflow-False-False] ___________________________________________
arguments = (), kwargs = {}
@handle_frontend_test(
fn_tree="numpy.modf",
> dtypes_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("float", "int"),
),
where=np_frontend_helpers.where(),
)
E hypothesis.errors.InvalidArgument: test_numpy_modf() got an unexpected keyword argument 'dtypes_and_x', from `dtypes_and_x=dtype_and_values(available_dtypes=get_dtypes(kind='float', index='int'))` in @given
ivy_tests/test_ivy/test_frontends/test_numpy/test_mathematical_functions/test_trigonometric_functions.py:10: InvalidArgument
_____________________________________________ test_numpy_modf[cpu-ivy.functional.backends.torch-False-False] ______________________________________________
arguments = (), kwargs = {}
@handle_frontend_test(
fn_tree="numpy.modf",
> dtypes_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("float", "int"),
),
where=np_frontend_helpers.where(),
)
E hypothesis.errors.InvalidArgument: test_numpy_modf() got an unexpected keyword argument 'dtypes_and_x', from `dtypes_and_x=dtype_and_values(available_dtypes=get_dtypes(kind='float', index='int'))` in @given
ivy_tests/test_ivy/test_frontends/test_numpy/test_mathematical_functions/test_trigonometric_functions.py:10: InvalidArgument
==================================================================== warnings summary =====================================================================
ivy/__init__.py:1164
/workspaces/ivy/ivy/__init__.py:1164: UserWarning: jax module has been imported while ivy doesn't import it without setting a backend, ignore if that's intended
warnings.warn(
ivy_tests/test_ivy/helpers/function_testing.py:69: 87 warnings
/workspaces/ivy/ivy_tests/test_ivy/helpers/function_testing.py:69: DeprecationWarning: `np.bool8` is a deprecated alias for `np.bool_`. (Deprecated NumPy 1.24)
import ivy.compiler.compiler as ic
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================= short test summary info =================================================================
FAILED ivy_tests/test_ivy/test_frontends/test_numpy/test_mathematical_functions/test_trigonometric_functions.py::test_numpy_modf[cpu-ivy.functional.backends.numpy-False-False] - hypothesis.errors.InvalidArgument: test_numpy_modf() got an unexpected keyword argument 'dtypes_and_x', from `dtypes_and_x=dtype_and_values(available_...
FAILED ivy_tests/test_ivy/test_frontends/test_numpy/test_mathematical_functions/test_trigonometric_functions.py::test_numpy_modf[cpu-ivy.functional.backends.jax-False-False] - hypothesis.errors.InvalidArgument: test_numpy_modf() got an unexpected keyword argument 'dtypes_and_x', from `dtypes_and_x=dtype_and_values(available_...
FAILED ivy_tests/test_ivy/test_frontends/test_numpy/test_mathematical_functions/test_trigonometric_functions.py::test_numpy_modf[cpu-ivy.functional.backends.tensorflow-False-False] - hypothesis.errors.InvalidArgument: test_numpy_modf() got an unexpected keyword argument 'dtypes_and_x', from `dtypes_and_x=dtype_and_values(available_...
FAILED ivy_tests/test_ivy/test_frontends/test_numpy/test_mathematical_functions/test_trigonometric_functions.py::test_numpy_modf[cpu-ivy.functional.backends.torch-False-False] - hypothesis.errors.InvalidArgument: test_numpy_modf() got an unexpected keyword argument 'dtypes_and_x', from `dtypes_and_x=dtype_and_values(available_...
============================================================= 4 failed, 88 warnings in 1.78s ==============================================================
@to_ivy_arrays_and_back | ||
@handle_numpy_casting | ||
@from_zero_dim_arrays_to_scalar | ||
def _modf( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please also clarify why do you need that underscore here? Thanks
def _modf( | |
def modf( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I referred to the ivy frontends docs which state that "In NumPy, add() is categorised under mathematical_functions with a sub-category of arithmetic_operations as shown in the numpy mathematical functions directory. It is important to note that add() is a universal function (ufunc) in NumPy, thus the function is actually an object with instance methods like .at and .reduce, etc. We deal with this in the NumPy frontend by including a ufunc class and initialising it in the init file" so thats why I used _modf.
2dec676
to
6a21713
Compare
Hey, @kurshakuz I did some changes and tried to resolve the errors, can u please review it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @RakshitKumar04! I have tested your implementation and it is failing the tests. Please make sure it is correct and passes all of the tests, so that I can have a further look.
E ivy.utils.exceptions.IvyException: Out argument must be an ivy.frontends.numpy.ndarray object
a2c810c
to
7d7a9d1
Compare
Hey, @kurshakuz I tried solving the error, please guide if it fails again |
Hey, @kurshakuz please review my pr. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the following error and run the tests locally to see if your implementation works:
E ivy.utils.exceptions.IvyException: Out argument must be an ivy.frontends.numpy.ndarray object
588c779
to
5970458
Compare
. |
02b65e5
to
08a3011
Compare
Hey, @kurshakuz can you please guide me on resolving these errors. I ran the modf function on my local machine. Out of 5, 1st test case got passed and the other 4 showed the error listed below.
E AttributeError: 'ArrayImpl' object has no attribute 'array_ufunc'
E AttributeError: 'tensorflow.python.framework.ops.EagerTensor' object has no attribute 'array_ufunc'
E AttributeError: 'Tensor' object has no attribute 'array_ufunc'
E TypeError: 'NoneType' object is not callable |
@RakshitKumar04 I have not seen this error previously as well. I would suggest to address that issue in one of the Discord channels, maybe some has experience of dealing with that error. Can you do that? |
@kurshakuz Yes Sir, I will do that. |
d146279
to
e4ed4f6
Compare
Hey @kurshakuz how do I resolve this error? |
e4ed4f6
to
3bc89de
Compare
Hey @RakshitKumar04 and @kurshakuz It seems like is the casting issue that is on our testing side 😁 |
Close #12086