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

[BUG] FP16 Types Not Allowed for Atan2 Method #3545

Open
AzeezIsh opened this issue Mar 20, 2024 · 0 comments
Open

[BUG] FP16 Types Not Allowed for Atan2 Method #3545

AzeezIsh opened this issue Mar 20, 2024 · 0 comments
Assignees
Labels

Comments

@AzeezIsh
Copy link

Manual type assertions not allowing FP16 types not allowing for atan2. Has not been updated to allow FP16.

Description

if (type != f32 && type != f64) {

Reproducible Code and/or Steps

shape = (4, 7, 4, 9), dtype_name = arrayfire.float16(typecode)

@pytest.mark.parametrize(
    "shape",
    [
        (),
        (random.randint(1, 10),),
        (random.randint(1, 10), random.randint(1, 10)),
        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
        (random.randint(1, 10), random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)),
    ],
)
@pytest.mark.parametrize("dtype_name", util.get_float_types())
def test_atan2_shape_dtypes(shape: tuple, dtype_name: dtype.Dtype) -> None:
    """Test inverse tan operation across all supported data types."""
    util.check_type_supported(dtype_name)
    lhs = wrapper.randu(shape, dtype_name)
    rhs = wrapper.randu(shape, dtype_name)
  result = wrapper.atan2(lhs, rhs)

tests/test_trig.py:121:


arrayfire_wrapper/lib/mathematical_functions/trigonometric_functions.py:30: in atan2
return binary_op(atan2.name, lhs, rhs)
arrayfire_wrapper/lib/_utility.py:15: in binary_op
call_from_clib(c_func_name, ctypes.pointer(out), lhs, rhs, bcast_var.get())
arrayfire_wrapper/lib/_utility.py:32: in call_from_clib
_process_error(backend)


backend = <arrayfire_wrapper._backend.Backend object at 0x7fe5af859d20>

def _process_error(backend: Backend) -> None:
    err_str = ctypes.c_char_p(0)
    err_len = CDimT(0)
    backend.clib.af_get_last_error(ctypes.pointer(err_str), ctypes.pointer(err_len))
  raise RuntimeError(to_str(err_str))

E RuntimeError: In function af_atan2
E In file src/api/c/binary.cpp:480
E Only floating point arrays are supported for atan2

@AzeezIsh AzeezIsh added the bug label Mar 20, 2024
@christophe-murphy christophe-murphy self-assigned this May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants