arrayfire / arrayfire

ArrayFire: a general purpose GPU library.

Home Page:https://arrayfire.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] FP16 Types Not Allowed for Atan2 Method

AzeezIsh opened this issue · comments

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