Skip to content

Commit 718f1cc

Browse files
committed
FEAT: Adding sigmoid function
1 parent 3a64cac commit 718f1cc

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

arrayfire/arith.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,26 @@ def pow2(a):
698698
"""
699699
return _arith_unary_func(a, backend.get().af_pow2)
700700

701+
def sigmoid(a):
702+
"""
703+
Raise 2 to the power of each element in input.
704+
705+
Parameters
706+
----------
707+
a : af.Array
708+
Multi dimensional arrayfire array.
709+
710+
Returns
711+
--------
712+
out : af.Array
713+
array where each element is outout of a sigmoid function for the corresponding value from `a`.
714+
715+
Note
716+
-------
717+
`a` must not be complex.
718+
"""
719+
return _arith_unary_func(a, backend.get().af_sigmoid)
720+
701721
def exp(a):
702722
"""
703723
Exponential of each element in the array.

tests/simple/arith.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ def simple_arith(verbose = False):
173173
display_func(af.root(a, b))
174174
display_func(af.pow(a, b))
175175
display_func(af.pow2(a))
176+
display_func(af.sigmoid(a))
176177
display_func(af.exp(a))
177178
display_func(af.expm1(a))
178179
display_func(af.erf(a))

0 commit comments

Comments
 (0)