ivy icon indicating copy to clipboard operation
ivy copied to clipboard

added rfft2 function update

Open rajveer43 opened this issue 2 years ago • 10 comments

Close #16357

rajveer43 avatar Jun 17 '23 18:06 rajveer43

only test no 24 is not passing..any clue!

rajveer43 avatar Jun 18 '23 10:06 rajveer43

image Here is the ss of logs

rajveer43 avatar Jun 21 '23 08:06 rajveer43

E:\MyJob\Ivy\ivy\ivy_dev\Scripts\python.exe "C:/Program Files/JetBrains/PyCharm 2023.1.2/plugins/python/helpers/pycharm/_jb_pytest_runner.py" --path ivy_dev/Lib/site-packages/ivy_tests/test_ivy/test_frontends/test_numpy/test_fft/test_discrete_fourier_transform.py 
Testing started at 2:09 PM ...
Launching pytest with arguments ivy_dev/Lib/site-packages/ivy_tests/test_ivy/test_frontends/test_numpy/test_fft/test_discrete_fourier_transform.py --no-header --no-summary -q in E:\MyJob\Ivy\ivy

Use Database in ReadOnly Mode with local caching !
============================= test session starts =============================
collecting ... collected 0 items / 1 error

!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
============================== 1 error in 0.40s ===============================

ivy_dev/Lib/site-packages/ivy_tests/test_ivy/test_frontends/test_numpy/test_fft/test_discrete_fourier_transform.py:None (ivy_dev/Lib/site-packages/ivy_tests/test_ivy/test_frontends/test_numpy/test_fft/test_discrete_fourier_transform.py)
ImportError while importing test module 'E:\MyJob\Ivy\ivy\ivy_dev\Lib\site-packages\ivy_tests\test_ivy\test_frontends\test_numpy\test_fft\test_discrete_fourier_transform.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
ivy_dev\lib\site-packages\_pytest\python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
ivy_dev\lib\site-packages\_pytest\pathlib.py:564: in import_path
    importlib.import_module(module_name)
C:\Users\Lenovo\AppData\Local\Programs\Python\Python38\lib\importlib\__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
ivy_dev\lib\site-packages\_pytest\assertion\rewrite.py:178: in exec_module
    exec(co, module.__dict__)
ivy_dev\Lib\site-packages\ivy_tests\test_ivy\test_frontends\test_numpy\test_fft\test_discrete_fourier_transform.py:7: in <module>
    from ivy_tests.test_ivy.test_functional.test_experimental.test_nn.test_layers import (
E   ModuleNotFoundError: No module named 'ivy_tests.test_ivy.test_functional.test_experimental'

Process finished with exit code 2

here are the logs

rajveer43 avatar Jun 21 '23 08:06 rajveer43

Do I Need to add the test function at the backend as well?

rajveer43 avatar Jun 21 '23 09:06 rajveer43

E:\MyJob\Ivy\ivy\ivy_dev\Scripts\python.exe "C:/Program Files/JetBrains/PyCharm 2023.1.2/plugins/python/helpers/pycharm/_jb_pytest_runner.py" --path ivy_dev/Lib/site-packages/ivy_tests/test_ivy/test_frontends/test_numpy/test_fft/test_discrete_fourier_transform.py 
Testing started at 2:09 PM ...
Launching pytest with arguments ivy_dev/Lib/site-packages/ivy_tests/test_ivy/test_frontends/test_numpy/test_fft/test_discrete_fourier_transform.py --no-header --no-summary -q in E:\MyJob\Ivy\ivy

Use Database in ReadOnly Mode with local caching !
============================= test session starts =============================
collecting ... collected 0 items / 1 error

!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
============================== 1 error in 0.40s ===============================

ivy_dev/Lib/site-packages/ivy_tests/test_ivy/test_frontends/test_numpy/test_fft/test_discrete_fourier_transform.py:None (ivy_dev/Lib/site-packages/ivy_tests/test_ivy/test_frontends/test_numpy/test_fft/test_discrete_fourier_transform.py)
ImportError while importing test module 'E:\MyJob\Ivy\ivy\ivy_dev\Lib\site-packages\ivy_tests\test_ivy\test_frontends\test_numpy\test_fft\test_discrete_fourier_transform.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
ivy_dev\lib\site-packages\_pytest\python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
ivy_dev\lib\site-packages\_pytest\pathlib.py:564: in import_path
    importlib.import_module(module_name)
C:\Users\Lenovo\AppData\Local\Programs\Python\Python38\lib\importlib\__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
ivy_dev\lib\site-packages\_pytest\assertion\rewrite.py:178: in exec_module
    exec(co, module.__dict__)
ivy_dev\Lib\site-packages\ivy_tests\test_ivy\test_frontends\test_numpy\test_fft\test_discrete_fourier_transform.py:7: in <module>
    from ivy_tests.test_ivy.test_functional.test_experimental.test_nn.test_layers import (
E   ModuleNotFoundError: No module named 'ivy_tests.test_ivy.test_functional.test_experimental'

Process finished with exit code 2

here are the logs

@rajveer43 There is an issue with your installation of ivy I think. Did you install ivy using pip or by cloning it and installing it from source?

hmahmood24 avatar Jun 21 '23 14:06 hmahmood24

@hmahmood24 , I first forked the repo and then cloned it.. then followed the docs. created Venv. and then tried running tests. but unfortunately, it gave error so I directly ran on workflows. Can we have a 2-min screen-sharing chat on discord? see whats wrong with my repo.

rajveer43 avatar Jun 21 '23 14:06 rajveer43

@hmahmood24,

image this folders iv-tests and ivy are in my venv ivy-dev

as well as in the Ivy repo folder as welll this might taking as the circular import. and causing the error

rajveer43 avatar Jun 22 '23 10:06 rajveer43

E:\MyJob\Ivy\ivy\ivy_dev\Scripts\python.exe "C:/Program Files/JetBrains/PyCharm 2023.1.2/plugins/python/helpers/pycharm/_jb_pytest_runner.py" --target ivy_tests/test_ivy/test_frontends/test_numpy/test_fft/test_discrete_fourier_transform.py::test_numpy_rfft2 
Testing started at 10:23 PM ...
Launching pytest with arguments ivy_tests/test_ivy/test_frontends/test_numpy/test_fft/test_discrete_fourier_transform.py::test_numpy_rfft2 --no-header --no-summary -q in E:\MyJob\Ivy\ivy

Use Database in ReadOnly Mode with local caching !
============================= test session starts =============================
collecting ... collected 2 items

ivy_tests/test_ivy/test_frontends/test_numpy/test_fft/test_discrete_fourier_transform.py::test_numpy_rfft2[cpu-ivy.functional.backends.numpy-False-False] 
ivy_tests/test_ivy/test_frontends/test_numpy/test_fft/test_discrete_fourier_transform.py::test_numpy_rfft2[cpu-ivy.functional.backends.jax-False-False] 

======================== 2 failed, 2 warnings in 8.28s ========================
FAILED [ 50%]
ivy_tests\test_ivy\test_frontends\test_numpy\test_fft\test_discrete_fourier_transform.py:193 (test_numpy_rfft2[cpu-ivy.functional.backends.numpy-False-False])
frontend = 'numpy', on_device = 'cpu'

    @handle_frontend_test(
>       fn_tree="numpy.fft.rfft2",
        dtype_input_axis=helpers.dtype_values_axis(
            available_dtypes=helpers.get_dtypes("valid"),
            min_num_dims=st.one_of(st.integers(min_value=0), st.none()),
            max_num_dims=2,
            force_tuple_axis=True,
        ),
        norm=st.sampled_from(["backward", "ortho", "forward"]),
        s=st.one_of(st.lists(st.integers()), st.none()),
        axes=st.one_of(st.none(), st.lists(st.integers())),
    )

ivy_tests\test_ivy\test_frontends\test_numpy\test_fft\test_discrete_fourier_transform.py:195: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
ivy_tests\test_ivy\helpers\hypothesis_helpers\array_helpers.py:752: in dtype_values_axis
    results = draw(
ivy_dev\lib\site-packages\hypothesis\internal\conjecture\data.py:951: in draw
    return strategy.do_draw(self)
ivy_dev\lib\site-packages\hypothesis\strategies\_internal\lazy.py:156: in do_draw
    return data.draw(self.wrapped_strategy)
ivy_dev\lib\site-packages\hypothesis\internal\conjecture\data.py:951: in draw
    return strategy.do_draw(self)
ivy_dev\lib\site-packages\hypothesis\strategies\_internal\core.py:1563: in do_draw
    return self.definition(data.draw, *self.args, **self.kwargs)
ivy_tests\test_ivy\helpers\hypothesis_helpers\array_helpers.py:506: in dtype_and_values
    shape = draw(
ivy_dev\lib\site-packages\hypothesis\internal\conjecture\data.py:951: in draw
    return strategy.do_draw(self)
ivy_dev\lib\site-packages\hypothesis\strategies\_internal\shared.py:37: in do_draw
    sharing[key] = data.draw(self.base)
ivy_dev\lib\site-packages\hypothesis\internal\conjecture\data.py:951: in draw
    return strategy.do_draw(self)
ivy_dev\lib\site-packages\hypothesis\strategies\_internal\lazy.py:156: in do_draw
    return data.draw(self.wrapped_strategy)
ivy_dev\lib\site-packages\hypothesis\internal\conjecture\data.py:951: in draw
    return strategy.do_draw(self)
ivy_dev\lib\site-packages\hypothesis\strategies\_internal\core.py:1563: in do_draw
    return self.definition(data.draw, *self.args, **self.kwargs)
ivy_tests\test_ivy\helpers\hypothesis_helpers\general_helpers.py:225: in get_shape
    shape = draw(
ivy_dev\lib\site-packages\hypothesis\internal\conjecture\data.py:937: in draw
    strategy.validate()
ivy_dev\lib\site-packages\hypothesis\strategies\_internal\strategies.py:417: in validate
    self.do_validate()
ivy_dev\lib\site-packages\hypothesis\strategies\_internal\lazy.py:129: in do_validate
    w = self.wrapped_strategy
ivy_dev\lib\site-packages\hypothesis\strategies\_internal\lazy.py:108: in wrapped_strategy
    base = self.function(*self.__args, **self.__kwargs)
ivy_dev\lib\site-packages\hypothesis\strategies\_internal\core.py:272: in lists
    check_valid_sizes(min_size, max_size)
ivy_dev\lib\site-packages\hypothesis\internal\validation.py:125: in check_valid_sizes
    check_valid_size(min_size, "min_size")
ivy_dev\lib\site-packages\hypothesis\internal\validation.py:103: in check_valid_size
    check_type(int, value, name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

typ = <class 'int'>, arg = one_of(integers(min_value=0), none())
name = 'min_size'

    @check_function
    def check_type(typ, arg, name):
        if not isinstance(arg, typ):
            if isinstance(typ, tuple):
                assert len(typ) >= 2, "Use bare type instead of len-1 tuple"
                typ_string = "one of " + ", ".join(t.__name__ for t in typ)
            else:
                typ_string = typ.__name__
    
                if typ_string == "SearchStrategy":
                    from hypothesis.strategies import SearchStrategy
    
                    # Use hypothesis.strategies._internal.strategies.check_strategy
                    # instead, as it has some helpful "did you mean..." logic.
                    assert typ is not SearchStrategy, "use check_strategy instead"
    
>           raise InvalidArgument(
                f"Expected {typ_string} but got {name}={arg!r} (type={type(arg).__name__})"
            )
E           hypothesis.errors.InvalidArgument: Expected int but got min_size=one_of(integers(min_value=0), none()) (type=OneOfStrategy)
E           
E           You can reproduce this example by temporarily adding @reproduce_failure('6.79.2', b'AAA=') as a decorator on your test case

ivy_dev\lib\site-packages\hypothesis\internal\validation.py:35: InvalidArgument
FAILED [100%]
ivy_tests\test_ivy\test_frontends\test_numpy\test_fft\test_discrete_fourier_transform.py:193 (test_numpy_rfft2[cpu-ivy.functional.backends.jax-False-False])
frontend = 'numpy', on_device = 'cpu'

    @handle_frontend_test(
>       fn_tree="numpy.fft.rfft2",
        dtype_input_axis=helpers.dtype_values_axis(
            available_dtypes=helpers.get_dtypes("valid"),
            min_num_dims=st.one_of(st.integers(min_value=0), st.none()),
            max_num_dims=2,
            force_tuple_axis=True,
        ),
        norm=st.sampled_from(["backward", "ortho", "forward"]),
        s=st.one_of(st.lists(st.integers()), st.none()),
        axes=st.one_of(st.none(), st.lists(st.integers())),
    )

ivy_tests\test_ivy\test_frontends\test_numpy\test_fft\test_discrete_fourier_transform.py:195: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
ivy_tests\test_ivy\helpers\hypothesis_helpers\array_helpers.py:752: in dtype_values_axis
    results = draw(
ivy_dev\lib\site-packages\hypothesis\internal\conjecture\data.py:951: in draw
    return strategy.do_draw(self)
ivy_dev\lib\site-packages\hypothesis\strategies\_internal\lazy.py:156: in do_draw
    return data.draw(self.wrapped_strategy)
ivy_dev\lib\site-packages\hypothesis\internal\conjecture\data.py:951: in draw
    return strategy.do_draw(self)
ivy_dev\lib\site-packages\hypothesis\strategies\_internal\core.py:1563: in do_draw
    return self.definition(data.draw, *self.args, **self.kwargs)
ivy_tests\test_ivy\helpers\hypothesis_helpers\array_helpers.py:506: in dtype_and_values
    shape = draw(
ivy_dev\lib\site-packages\hypothesis\internal\conjecture\data.py:951: in draw
    return strategy.do_draw(self)
ivy_dev\lib\site-packages\hypothesis\strategies\_internal\shared.py:37: in do_draw
    sharing[key] = data.draw(self.base)
ivy_dev\lib\site-packages\hypothesis\internal\conjecture\data.py:951: in draw
    return strategy.do_draw(self)
ivy_dev\lib\site-packages\hypothesis\strategies\_internal\lazy.py:156: in do_draw
    return data.draw(self.wrapped_strategy)
ivy_dev\lib\site-packages\hypothesis\internal\conjecture\data.py:951: in draw
    return strategy.do_draw(self)
ivy_dev\lib\site-packages\hypothesis\strategies\_internal\core.py:1563: in do_draw
    return self.definition(data.draw, *self.args, **self.kwargs)
ivy_tests\test_ivy\helpers\hypothesis_helpers\general_helpers.py:225: in get_shape
    shape = draw(
ivy_dev\lib\site-packages\hypothesis\internal\conjecture\data.py:937: in draw
    strategy.validate()
ivy_dev\lib\site-packages\hypothesis\strategies\_internal\strategies.py:417: in validate
    self.do_validate()
ivy_dev\lib\site-packages\hypothesis\strategies\_internal\lazy.py:129: in do_validate
    w = self.wrapped_strategy
ivy_dev\lib\site-packages\hypothesis\strategies\_internal\lazy.py:108: in wrapped_strategy
    base = self.function(*self.__args, **self.__kwargs)
ivy_dev\lib\site-packages\hypothesis\strategies\_internal\core.py:272: in lists
    check_valid_sizes(min_size, max_size)
ivy_dev\lib\site-packages\hypothesis\internal\validation.py:125: in check_valid_sizes
    check_valid_size(min_size, "min_size")
ivy_dev\lib\site-packages\hypothesis\internal\validation.py:103: in check_valid_size
    check_type(int, value, name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

typ = <class 'int'>, arg = one_of(integers(min_value=0), none())
name = 'min_size'

    @check_function
    def check_type(typ, arg, name):
        if not isinstance(arg, typ):
            if isinstance(typ, tuple):
                assert len(typ) >= 2, "Use bare type instead of len-1 tuple"
                typ_string = "one of " + ", ".join(t.__name__ for t in typ)
            else:
                typ_string = typ.__name__
    
                if typ_string == "SearchStrategy":
                    from hypothesis.strategies import SearchStrategy
    
                    # Use hypothesis.strategies._internal.strategies.check_strategy
                    # instead, as it has some helpful "did you mean..." logic.
                    assert typ is not SearchStrategy, "use check_strategy instead"
    
>           raise InvalidArgument(
                f"Expected {typ_string} but got {name}={arg!r} (type={type(arg).__name__})"
            )
E           hypothesis.errors.InvalidArgument: Expected int but got min_size=one_of(integers(min_value=0), none()) (type=OneOfStrategy)
E           
E           You can reproduce this example by temporarily adding @reproduce_failure('6.79.2', b'AAA=') as a decorator on your test case

ivy_dev\lib\site-packages\hypothesis\internal\validation.py:35: InvalidArgument

Process finished with exit code 1

here are the latest logs

rajveer43 avatar Jun 22 '23 16:06 rajveer43

@hmahmood24 Can you check how many tests are actually passing I mean 132/138, or anything. one more thing, about CI test, Whatever I have seen it on most of the PRs, there are CI tests failing, and there PR have been merged. So How much it is important to run CI tests? how can I Do it locally?

Do I Need to add the test function at the backend as well? as there is no backend function in ivy.functional.backends.numpy.experimental.layers.py. all other fft functions are there but rfft2 is not there? Just asking out of curiosity.

rajveer43 avatar Jun 24 '23 17:06 rajveer43

Hey @rajveer43, requested changes for you. If the tests still fail for you, then they would probably be because of this line here: s=st.one_of(st.lists(st.integers()), st.none()) cauisng index out of range errors for example. If that happens you'll probably need to implement a custom hypothesis strategy for the test that generates the valid input parameters. Try looking into the tests for fft2 in other frontends to get an idea of how to generate valid data for this function since both the functions take in similar arguments to some extent.

Also, I'm not sure that is the correct way to calculate rfft2 by iterating over the axes and passing the inputs to ivy.dft. Have you verified that this is indeed the correct way to implement rfft2? Quick way to verify that would be by passing in inputs to your frontend function and also to the original numpy function and comparing the results for the two and seeing if they match or not. Can you do that as well?

Also one more thing, please don't mark the changes suggested as resolved because that is for the reviewer to resolve/unresolve if they think the changes have been sufficiently dealt with. Thanks and good luck!

@hmahmood24, I apologize for any inconvenience caused. I will make the necessary adjustments to the s parameter in the hypothesis strategy and ensure that it generates valid input parameters. Additionally, I will carefully examine the implementation of the rfft2 function and compare its results with the original NumPy function to verify its correctness.

I will refrain from marking the suggested changes as resolved, as I understand that it is the reviewer's responsibility to determine whether the changes have been adequately addressed.

you can iterate over multiple axes using a loop to calculate the DFT (Discrete Fourier Transform) in your code. In the case of the rfft2 function, which calculates the 2D real-valued DFT, you can iterate over the axes specified in the axes parameter and apply the DFT operation sequentially for each axis.

rajveer43 avatar Jun 28 '23 11:06 rajveer43

Hi I did all the changes, I checked the failing test and found out that they are not related to rfft2, can you please check the changes.

@rajveer43 Can you please run your function locally? You've made an error that would break the test but I'm guessing you haven't tested your function locally at all?

hmahmood24 avatar Jun 29 '23 18:06 hmahmood24

Hi I did all the changes, I checked the failing test and found out that they are not related to rfft2, can you please check the changes.

@rajveer43 Can you please run your function locally? You've made an error that would break the test but I'm guessing you haven't tested your function locally at all?

I have tested it locally. it is failing there. I got it now it will trigger the intelligent tests and going to pass anyways.

rajveer43 avatar Jun 30 '23 14:06 rajveer43

`args = (ivy.array([[[-1.]]]),), kwargs = {'dim': [], 'norm': 'backward', 's': []}

@functools.wraps(fn)
def _handle_exceptions(*args, **kwargs):
    """
    Catch all exceptions and raise them in IvyException.

    Parameters
    ----------
    args
        The arguments to be passed to the function.

    kwargs
        The keyword arguments to be passed to the function.

    Returns
    -------
        The return of the function, or raise IvyException if error is thrown.
    """
    try:
      return fn(*args, **kwargs)

ivy/utils/exceptions.py:210:


ivy/func_wrapper.py:400: in _handle_array_like_without_promotion return fn(*args, **kwargs) ivy/func_wrapper.py:864: in _handle_out_argument return fn(*args, out=out, **kwargs) ivy/func_wrapper.py:440: in _inputs_to_native_arrays return fn(*new_args, **new_kwargs) ivy/func_wrapper.py:546: in _outputs_to_ivy_arrays ret = fn(*args, **kwargs)


x = array([[[-1.]]])

def fft2(
    x: np.ndarray,
    *,
    s: Sequence[int] = None,
    dim: Sequence[int] = (-2, -1),
    norm: str = "backward",
    out: Optional[np.ndarray] = None,
) -> np.ndarray:
    if not all(isinstance(j, int) for j in dim):
        raise ivy.utils.exceptions.IvyError(
            f"Expecting {dim} to be a sequence of integers <class integer>"
        )
    if s is None:
        s = (x.shape[dim[0]], x.shape[dim[1]])
    if all(j < -len(x.shape) for j in s):
      raise ivy.utils.exceptions.IvyError(
            f"Invalid dim {dim}, expecting ranging"
            " from {-len(x.shape)} to {len(x.shape)-1}  "
        )

E ivy.utils.exceptions.IvyError: Invalid dim [], expecting ranging from {-len(x.shape)} to {len(x.shape)-1}

ivy/functional/backends/numpy/experimental/layers.py:878: IvyError

During handling of the above exception, another exception occurred:

frontend = 'numpy', on_device = 'cpu'

@handle_frontend_test(
  fn_tree="numpy.fft.rfft2",
    dtype_input_axis=helpers.dtype_values_axis(
        available_dtypes=helpers.get_dtypes("float"),
        min_num_dims=2,
        max_num_dims=2,
        force_tuple_axis=True,
        # shape=(2,2),
    ),
    norm=st.sampled_from(["backward", "ortho", "forward"]),
    s=st.lists(st.integers(min_value=2, max_value=10)),
    # dim=st.lists(st.integers(min_value=-2, max_value=-1)).map(
    #     lambda dims: tuple(dims) if dims else (-2, -1)
    # ),
    dim=st.lists(st.integers(min_value=-2, max_value=-1)),
)

ivy_tests/test_ivy/test_frontends/test_numpy/test_fft/test_discrete_fourier_transform.py:218:


ivy_tests/test_ivy/test_frontends/test_numpy/test_fft/test_discrete_fourier_transform.py:237: in test_numpy_rfft2 helpers.test_frontend_function( ivy_tests/test_ivy/helpers/function_testing.py:608: in test_frontend_function ret = get_frontend_ret( ivy_tests/test_ivy/helpers/function_testing.py:1776: in get_frontend_ret ret = frontend_fn(*args, **kwargs) ivy/functional/frontends/numpy/fft/discrete_fourier_transform.py:149: in rfft2 x = ivy.fft2(x, s=s, dim=dim, norm=norm)


args = (ivy.array([[[-1.]]]),), kwargs = {'dim': [], 'norm': 'backward', 's': []}

@functools.wraps(fn)
def _handle_exceptions(*args, **kwargs):
    """
    Catch all exceptions and raise them in IvyException.

    Parameters
    ----------
    args
        The arguments to be passed to the function.

    kwargs
        The keyword arguments to be passed to the function.

    Returns
    -------
        The return of the function, or raise IvyException if error is thrown.
    """
    try:
        return fn(*args, **kwargs)
    # Not to rethrow as IvyBackendException
    except IvyNotImplementedException as e:
        raise e
    except IvyError as e:
        _write_traceback_history(buffer)
      raise ivy.utils.exceptions.IvyError(
            fn.__name__, buffer.getvalue() + " " + str(e), include_backend=True
        )

E ivy.utils.exceptions.IvyError: numpy: fft2: File "/workspaces/ivy/ivy/utils/exceptions.py", line 210, in _handle_exceptions E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 400, in _handle_array_like_without_promotion E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 864, in _handle_out_argument E return fn(*args, out=out, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 440, in _inputs_to_native_arrays E return fn(*new_args, **new_kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 546, in _outputs_to_ivy_arrays E ret = fn(*args, **kwargs) E File "/workspaces/ivy/ivy/functional/backends/numpy/experimental/layers.py", line 878, in fft2 E raise ivy.utils.exceptions.IvyError( E During the handling of the above exception, another exception occurred: E File "/workspaces/ivy/ivy/utils/exceptions.py", line 210, in _handle_exceptions E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 400, in _handle_array_like_without_promotion E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 864, in _handle_out_argument E return fn(*args, out=out, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 440, in _inputs_to_native_arrays E return fn(*new_args, **new_kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 546, in _outputs_to_ivy_arrays E ret = fn(*args, **kwargs) E File "/workspaces/ivy/ivy/functional/backends/numpy/experimental/layers.py", line 878, in fft2 E raise ivy.utils.exceptions.IvyError( E During the handling of the above exception, another exception occurred: E File "/workspaces/ivy/ivy/utils/exceptions.py", line 210, in _handle_exceptions E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 400, in _handle_array_like_without_promotion E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 864, in _handle_out_argument E return fn(*args, out=out, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 440, in _inputs_to_native_arrays E return fn(*new_args, **new_kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 546, in _outputs_to_ivy_arrays E ret = fn(*args, **kwargs) E File "/workspaces/ivy/ivy/functional/backends/numpy/experimental/layers.py", line 878, in fft2 E raise ivy.utils.exceptions.IvyError( E During the handling of the above exception, another exception occurred: E File "/workspaces/ivy/ivy/utils/exceptions.py", line 210, in _handle_exceptions E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 400, in _handle_array_like_without_promotion E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 864, in _handle_out_argument E return fn(*args, out=out, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 440, in _inputs_to_native_arrays E return fn(*new_args, **new_kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 546, in _outputs_to_ivy_arrays E ret = fn(*args, **kwargs) E File "/workspaces/ivy/ivy/functional/backends/numpy/experimental/layers.py", line 878, in fft2 E raise ivy.utils.exceptions.IvyError( E During the handling of the above exception, another exception occurred: E File "/workspaces/ivy/ivy/utils/exceptions.py", line 210, in _handle_exceptions E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 400, in _handle_array_like_without_promotion E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 864, in _handle_out_argument E return fn(*args, out=out, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 440, in _inputs_to_native_arrays E return fn(*new_args, **new_kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 546, in _outputs_to_ivy_arrays E ret = fn(*args, **kwargs) E File "/workspaces/ivy/ivy/functional/backends/numpy/experimental/layers.py", line 878, in fft2 E raise ivy.utils.exceptions.IvyError( E During the handling of the above exception, another exception occurred: E File "/workspaces/ivy/ivy/utils/exceptions.py", line 210, in _handle_exceptions E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 400, in _handle_array_like_without_promotion E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 864, in _handle_out_argument E return fn(*args, out=out, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 440, in _inputs_to_native_arrays E return fn(*new_args, **new_kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 546, in _outputs_to_ivy_arrays E ret = fn(*args, **kwargs) E File "/workspaces/ivy/ivy/functional/backends/numpy/experimental/layers.py", line 878, in fft2 E raise ivy.utils.exceptions.IvyError( E During the handling of the above exception, another exception occurred: E File "/workspaces/ivy/ivy/utils/exceptions.py", line 210, in _handle_exceptions E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 400, in _handle_array_like_without_promotion E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 864, in _handle_out_argument E return fn(*args, out=out, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 440, in _inputs_to_native_arrays E return fn(*new_args, **new_kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 546, in _outputs_to_ivy_arrays E ret = fn(*args, **kwargs) E File "/workspaces/ivy/ivy/functional/backends/numpy/experimental/layers.py", line 878, in fft2 E raise ivy.utils.exceptions.IvyError( E During the handling of the above exception, another exception occurred: E File "/workspaces/ivy/ivy/utils/exceptions.py", line 210, in _handle_exceptions E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 400, in _handle_array_like_without_promotion E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 864, in _handle_out_argument E return fn(*args, out=out, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 440, in _inputs_to_native_arrays E return fn(*new_args, **new_kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 546, in _outputs_to_ivy_arrays E ret = fn(*args, **kwargs) E File "/workspaces/ivy/ivy/functional/backends/numpy/experimental/layers.py", line 878, in fft2 E raise ivy.utils.exceptions.IvyError( E During the handling of the above exception, another exception occurred: E File "/workspaces/ivy/ivy/utils/exceptions.py", line 210, in _handle_exceptions E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 400, in _handle_array_like_without_promotion E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 864, in _handle_out_argument E return fn(*args, out=out, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 440, in _inputs_to_native_arrays E return fn(*new_args, **new_kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 546, in _outputs_to_ivy_arrays E ret = fn(*args, **kwargs) E File "/workspaces/ivy/ivy/functional/backends/numpy/experimental/layers.py", line 878, in fft2 E raise ivy.utils.exceptions.IvyError( E During the handling of the above exception, another exception occurred: E File "/workspaces/ivy/ivy/utils/exceptions.py", line 210, in _handle_exceptions E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 400, in _handle_array_like_without_promotion E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 864, in _handle_out_argument E return fn(*args, out=out, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 440, in _inputs_to_native_arrays E return fn(*new_args, **new_kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 546, in _outputs_to_ivy_arrays E ret = fn(*args, **kwargs) E File "/workspaces/ivy/ivy/functional/backends/numpy/experimental/layers.py", line 878, in fft2 E raise ivy.utils.exceptions.IvyError( E During the handling of the above exception, another exception occurred: E File "/workspaces/ivy/ivy/utils/exceptions.py", line 210, in _handle_exceptions E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 400, in _handle_array_like_without_promotion E return fn(*args, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 864, in _handle_out_argument E return fn(*args, out=out, **kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 440, in _inputs_to_native_arrays E return fn(*new_args, **new_kwargs) E File "/workspaces/ivy/ivy/func_wrapper.py", line 546, in _outputs_to_ivy_arrays E ret = fn(*args, **kwargs) E File "/workspaces/ivy/ivy/functional/backends/numpy/experimental/layers.py", line 878, in fft2 E raise ivy.utils.exceptions.IvyError( E During the handling of the above exception, another exception occurred: E Invalid dim [], expecting ranging from {-len(x.shape)} to {len(x.shape)-1}
E Falsifying example: test_numpy_rfft2( E frontend='numpy', E on_device='cpu', E dtype_input_axis=(['float64'], [array([[-1.]])], 0), E norm='backward', E s=[], E dim=[], E test_flags=FrontendFunctionTestFlags( E num_positional_args=0, E with_out=False, E inplace=False, E as_variable=[False], E native_arrays=[False], E generate_frontend_arrays=False, E ), E fn_tree='ivy.functional.frontends.numpy.fft.rfft2', E ) E
E You can reproduce this example by temporarily adding @reproduce_failure('6.80.0', b'AXicY2CAAEYYzcSAAAAAVwAF') as a decorator on your test case

ivy/utils/exceptions.py:216: IvyError`

rajveer43 avatar Jul 04 '23 05:07 rajveer43

@hmahmood24 , Woud you suggest some hints to generate custom stretegies for the tests to generate vaild test cases?

rajveer43 avatar Jul 04 '23 06:07 rajveer43

I will do it soon after the implementation of rfftn function.

rajveer43 avatar Jul 10 '23 16:07 rajveer43

I will do it soon

rajveer43 avatar Jul 17 '23 08:07 rajveer43

the function is still in the update process

rajveer43 avatar Jul 23 '23 03:07 rajveer43

I am not working on it currently do not have time

rajveer43 avatar Jul 25 '23 05:07 rajveer43