MCPcopy Create free account
hub / github.com/numpy/numpy / tanh

Function tanh

numpy/array_api/_elementwise_functions.py:743–751  ·  view source on GitHub ↗

Array API compatible wrapper for :py:func:`np.tanh `. See its docstring for more information.

(x: Array, /)

Source from the content-addressed store, hash-verified

741
742
743def tanh(x: Array, /) -> Array:
744 """
745 Array API compatible wrapper for :py:func:`np.tanh <numpy.tanh>`.
746
747 See its docstring for more information.
748 """
749 if x.dtype not in _floating_dtypes:
750 raise TypeError("Only floating-point dtypes are allowed in tanh")
751 return Array._new(np.tanh(x._array))
752
753
754def trunc(x: Array, /) -> Array:

Callers 2

test_testUfuncs1Method · 0.85
test_basic_ufuncsMethod · 0.85

Calls 1

_newMethod · 0.80

Tested by 2

test_testUfuncs1Method · 0.68
test_basic_ufuncsMethod · 0.68