ivy icon indicating copy to clipboard operation
ivy copied to clipboard

Close Kaiser_Window#17572

Open Enigmafiend opened this issue 1 year ago • 6 comments

Beta capped at 80 because for Beta that are very large the corresponding Bessel function becomes approx exp(Beta) which for high values results in an overflow, No real reason for the min val of window length as a signal length must be greater than 0 and 3 was an arbitrary small value. Note: I ran the test approx 12 times (Atleast thats how many I counted before the Log wouldnt scroll back) and only faced a single case where jax failed by returning an array of 0s which is impossible for any values of beta (The kaiser function gives a array of 1s at 0) and couldnt reproduce it so could be a bug Close https://github.com/unifyai/ivy/issues/17571

Enigmafiend avatar Jun 27 '23 17:06 Enigmafiend

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

Enigmafiend avatar Jun 27 '23 17:06 Enigmafiend

Frontend Task Checklist

IMPORTANT NOTICE 🚨:

The Ivy Docs represent the ground truth for the task descriptions and this checklist should only be used as a supplementary item to aid with the review process.

LEGEND 🗺:

  • ❌ : Check item is not completed.
  • ✅ : Check item is ready for review.
  • 🆘 : Stuck/Doubting implementation (PR author should add comments explaining why).
  • ⏩ : Check is not applicable to function (skip).
  • 🆗 : Check item is implemented and does not require any edits.

CHECKS 📑:

    • [x] ❌: The function/method definition is not missing any of the original arguments.
    • [ ] ❌: In case the function/method to be implemented is an alias of an existing function/method:
        • [ ] ❌: It is being declared as such by setting fun1 = fun2, rather than being re-implemented from scratch.
        • [ ] ❌: The alias is added to the existing function/method's test in the aliases parameter of handle_frontend_test/handle_frontend_method.
    • [x] ❌: The naming of the function/method and its arguments exactly matches the original.
    • [x] ❌: No defined argument is being ignored in the function/method's implementation.
    • [ ] ❌: In special cases where an argument's implementation should be pending due to an incomplete superset of an ivy function:
        • [ ] ❌: A descriptive comment has been left under the Implement superset behavior ToDo list in https://github.com/unifyai/ivy/issues/6406.
        • [ ] ❌: A ToDo comment has been added prompting to pass the frontend argument to the ivy function whose behavior is to be extended.
    • [x] ❌: In case a frontend function is being added:
        • [x] ❌: It is a composition of ivy functions.
        • [ ] ❌: In case the needed composition is long (using numerous ivy functions), a Missing Function Suggestion issue has been opened to suggest a new ivy function should be added to shorten the frontend implementation.
        • [ ] ❌: @to_ivy_arrays_and_back has been added to the function.
    • [ ] ❌: In case a frontend method is being added:
        • [ ] ❌: It is composed of existing frontend functions or methods.
        • [ ] ❌: If a required frontend function has not yet been added, the method may be implemented as a composition of ivy functions, making sure that:
          • [x] ❌: @to_ivy_arrays_and_back has been added to the method.
          • [ ] ❌: A ToDo comment has been made prompting to remove the decorator and update the implementation as soon as the missing function has been added.
    • [x] ❌: The function/method's test has been added (except in the alias case mentioned in <2>):
        • [x] ❌: All supported arguments are being generated in handle_frontend_test/handle_frontend_method and passed to test_frontend_function/test_frontend_method.
        • [x] ❌: The argument generation covers all possible supported values. Array sizes, dimensions, and axes adhere to the full supported set of the original function/method.
        • [ ] ❌: The available_dtypes parameter passed to the helper generating the function/method's input array is set to helpers.get_dtypes("valid"). If there are unsupported dtypes that cause the test to fail, they should be handled by adding @with_supported_dtypes/@with_unsupported_dtype to the function/method.
    • [x] ❌: The PR is not introducing any test failures.
        • [x] ❌: The lint checks are passing.
        • [x] ❌: The implemented test is passing for all backends.
    • [x] ❌: The PR closes a Sub Task issue linked to one of the open frontend ToDo lists.
    • [x] ❌: The function/method and its test have been added to the correct .py files corresponding to the addressed ToDo list.
    • [x] ❌: The PR only contains changes relevant to the addressed subtask.

Enigmafiend avatar Jun 27 '23 17:06 Enigmafiend

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 :hugs:

ivy-leaves avatar Jun 27 '23 17:06 ivy-leaves

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

Enigmafiend avatar Jun 29 '23 21:06 Enigmafiend

Got some help from Vishu and fixed the Paddle Backend aswell

Enigmafiend avatar Jun 29 '23 21:06 Enigmafiend

Had a small argument declaration position mismatch that is fixed now

Enigmafiend avatar Jun 29 '23 22:06 Enigmafiend

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

Enigmafiend avatar Jul 04 '23 16:07 Enigmafiend

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

Enigmafiend avatar Jul 05 '23 18:07 Enigmafiend

Thanks for the changes, your implementation seems to fail for paddle locally. If you are not able to reproduce the failure I've provided some of the stack trace below, you can add the @reproduce_failure decorator provided.

E           ivy.utils.exceptions.IvyValueError: paddle: kaiser_window:   File "/opt/project/ivy/ivy/utils/exceptions.py", line 210, in _handle_exceptions
E               return fn(*args, **kwargs)
E             File "/opt/project/ivy/ivy/func_wrapper.py", line 972, in _handle_nestable
E               return fn(*args, **kwargs)
E             File "/opt/project/ivy/ivy/func_wrapper.py", line 864, in _handle_out_argument
E               return fn(*args, out=out, **kwargs)
E             File "/opt/project/ivy/ivy/func_wrapper.py", line 440, in _inputs_to_native_arrays
E               return fn(*new_args, **new_kwargs)
E             File "/opt/project/ivy/ivy/func_wrapper.py", line 546, in _outputs_to_ivy_arrays
E               ret = fn(*args, **kwargs)
E             File "/opt/project/ivy/ivy/func_wrapper.py", line 754, in _infer_dtype
E               return fn(*args, dtype=dtype, **kwargs)
E             File "/opt/project/ivy/ivy/functional/backends/paddle/experimental/creation.py", line 47, in kaiser_window
E               return _kaiser_window(window_length, beta).cast(dtype)
E             File "/opt/project/ivy/ivy/functional/backends/paddle/experimental/creation.py", line 28, in _kaiser_window
E               ret = paddle_backend.i0(beta * for_sqrt) / paddle_backend.i0(beta)
E             File "/opt/fw/paddle/paddle/fluid/dygraph/math_op_patch.py", line 304, in __impl__
E               return math_op(self, other_var, -1)
E           During the handling of the above exception, another exception occurred:
E            (InvalidArgument) Axis should be less than 1, but received axis is 1.
E             [Hint: Expected axis < max_dim, but received axis:1 >= max_dim:1.] (at /paddle/paddle/phi/kernels/funcs/common_shape.h:53)
E           
E           Falsifying example: test_tensorflow_kaiser_window(
E               frontend='tensorflow',
E               on_device='cpu',
E               window_length=2,
E               beta=1.0,
E               fn_tree='ivy.functional.frontends.tensorflow.signal.kaiser_window',
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           )
E           
E           You can reproduce this example by temporarily adding @reproduce_failure('6.79.1', b'AXicY2BkQAAIGwAAKwAD') as a decorator on your test case

Kindly look into this, thanks 🙂

had a discussion with @MahmoudAshraf97 and fixed that

Enigmafiend avatar Jul 05 '23 18:07 Enigmafiend

This PR has been labelled as stale because it has been inactive for more than 7 days. If you would like to continue working on this PR, then please add another comment or this PR will be closed in 7 days.

ivy-seed avatar Jul 16 '23 05:07 ivy-seed

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

Enigmafiend avatar Jul 20 '23 22:07 Enigmafiend