celu#

ivy.celu(x, /, *, alpha=1.0, complex_mode='jax', out=None)[source]#

Apply the Continuously Differentiable Exponential Linear Unit (CELU) activation function to each element of the input.

Parameters:
  • x (Union[Array, NativeArray]) – Input array.

  • alpha (float, default: 1.0) – The alpha value (negative slope) for the CELU formulation. Default is 1.0

  • complex_mode (Literal['split', 'magnitude', 'jax'], default: 'jax') – optional specifier for how to handle complex data types. See ivy.func_wrapper.handle_complex_input for more detail.

  • out (Optional[Array], default: None) – optional output array, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Array

Returns:

ret – The input array with celu applied element-wise.

Examples

With ivy.Array input:

>>> x = ivy.array([0.39, -0.85])
>>> y = ivy.celu(x)
>>> y
ivy.array([ 0.39, -0.57])

With ivy.Container input:

>>> x = ivy.Container(a=ivy.array([0.39, -0.85]), b=ivy.array([1., -0.2]))
>>> y = ivy.celu(x)
>>> y
{
    a: ivy.array([0.38999999, -0.57]),
    b: ivy.array([1., -0.18])
}
Array.celu(self, /, *, alpha=1.0, complex_mode='jax', out=None)[source]#

ivy.Array instance method variant of ivy.celu. This method simply wraps the function, and so the docstring for ivy.celu also applies to this method with minimal changes.

Parameters:
  • self (Array) – input array.

  • alpha (float, default: 1.0) – the alpha (negative slope) value for CELU formulation.

  • complex_mode (Literal['split', 'magnitude', 'jax'], default: 'jax') – optional specifier for how to handle complex data types. See ivy.func_wrapper.handle_complex_input for more detail.

  • out (Optional[Array], default: None) – optional output array, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Array

Returns:

ret – an array with the celu activation function applied element-wise.

Examples

>>> x = ivy.array([0.39, -0.85])
>>> y = x.celu()
>>> print(y)
ivy.array([ 0.39, -0.57])
Container.celu(self, /, *, alpha=1.0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, complex_mode='jax', out=None)[source]#

ivy.Container instance method variant of ivy.leaky_relu. This method simply wraps the function, and so the docstring for ivy.leaky_relu also applies to this method with minimal changes.

Parameters:
  • self (Container) – input container.

  • alpha (Container, default: 1.0) – array or scalar specifying alpha (negative slope) value for CELU formulation.

  • key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The key-chains to apply or not apply the method to. Default is None.

  • to_apply (Union[bool, Container], default: True) – If True, the method will be applied to key_chains, otherwise key_chains will be skipped. Default is True.

  • prune_unapplied (Union[bool, Container], default: False) – Whether to prune key_chains for which the function was not applied. Default is False.

  • map_sequences (Union[bool, Container], default: False) – Whether to also map method to sequences (lists, tuples). Default is False.

  • complex_mode (Literal['split', 'magnitude', 'jax'], default: 'jax') – optional specifier for how to handle complex data types. See ivy.func_wrapper.handle_complex_input for more detail.

  • out (Optional[Container], default: None) – optional output container, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Container

Returns:

ret – a container with the celu unit function applied element-wise.

Examples

>>> x = ivy.Container(a=ivy.array([0.39, -0.85]), b=ivy.array([1., -0.2]))
>>> y = x.celu()
>>> print(y)
{
    a: ivy.array([0.38999999, -0.57]),
    b: ivy.array([1., -0.18])
}