tanh

Contents

tanh#

class brainunit.math.tanh(x, unit_to_scale=None, **kwargs)#

Hyperbolic tangent, element-wise.

Parameters:
  • x (Array | ndarray | bool | number | bool | int | float | complex | saiunit.Quantity) – Input values.

  • unit_to_scale (saiunit.Unit | None) – Unit used to convert x to a dimensionless number first.

Returns:

out – Element-wise hyperbolic tangent, in (-1, 1).

Return type:

Array

Examples

>>> import saiunit as u
>>> import jax.numpy as jnp
>>> u.math.tanh(jnp.array([0.0, 1.0]))
Array([0.       , 0.7615942], dtype=float32)