def cosh(x: Array, /) -> Array:
    """
    Array API compatible wrapper for :py:func:`np.cosh <numpy.cosh>`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in cosh")
    return Array._new(np.cosh(x._array))
Beispiel #2
0
 def backward(self):
     vector, out = self.get_ctx('vector', 'out')
     if out.grad is not None:
         vector_grad = xp.multiply(xp.cosh(vector.data)**(-2), out.grad)
         vector.accumulate_grad(vector_grad)
Beispiel #3
0
def dtanh(z):
    # print("Tanh derivative: " + str(z))
    return cp.power(cp.cosh(z), 2)
Beispiel #4
0
def sech__(z):
    return 1.0/cp.cosh(z)
 def dGohc(self, uc, vc, beta):
     return vc/cp.cosh(uc)**2
Beispiel #6
0
def cosh(x):
    return cp.cosh(x)