Skip to content

Commit 903e14d

Browse files
author
AzeezIsh
committed
Resolved neg() error, created base num_funcs tests
Fixed an error that only allowed for one dtype for negative class. Exploring how to resolve other runtime errors for hypotenuse and need to fill in all dtype testing for clamping func.
1 parent c414f5f commit 903e14d

File tree

2 files changed

+404
-1
lines changed

2 files changed

+404
-1
lines changed

arrayfire_wrapper/lib/mathematical_functions/numeric_functions.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
from arrayfire_wrapper.lib.mathematical_functions.arithmetic_operations import sub
88

99

10+
import arrayfire_wrapper.dtypes as dtype
11+
import arrayfire_wrapper.lib as wrapper
12+
13+
1014
def abs_(arr: AFArray, /) -> AFArray:
1115
"""
1216
source: https://arrayfire.org/docs/group__arith__func__abs.htm#ga7e8b3c848e6cda3d1f3b0c8b2b4c3f8f
@@ -75,7 +79,7 @@ def mod(lhs: AFArray, rhs: AFArray, /) -> AFArray:
7579

7680

7781
def neg(arr: AFArray) -> AFArray:
78-
return sub(create_constant_array(0, (1,), float32), arr)
82+
return sub(create_constant_array(0, (1,), dtype.c_api_value_to_dtype(wrapper.get_type(arr))), arr)
7983

8084

8185
def rem(lhs: AFArray, rhs: AFArray, /) -> AFArray:

0 commit comments

Comments
 (0)