mish#
- ivy.mish(x, /, *, out=None)[source]#
Apply the mish activation function element-wise.
- Parameters:
- Return type:
- Returns:
ret – an array containing the mish activation of each element in
x
.
Examples
With
ivy.Array
input:>>> x = ivy.array([-1., 0., 1.]) >>> y = ivy.mish(x) >>> print(y) ivy.array([-0.30340147, 0. , 0.86509842])
>>> x = ivy.array([1.5, 0.7, -2.4]) >>> y = ivy.zeros(3) >>> ivy.mish(x, out = y) >>> print(y) ivy.array([ 1.40337825, 0.56114835, -0.20788449])
With
ivy.Container
input:>>> x = ivy.Container(a=ivy.array([1.0, -1.2]), b=ivy.array([0.4, -0.2])) >>> x = ivy.mish(x) >>> print(x) { a: ivy.array([0.86509842, -0.30883577]), b: ivy.array([0.28903052, -0.10714479]) }
- Array.mish(self, /, *, out=None)#
ivy.Array instance method variant of ivy.mish. This method simply wraps the function, and so the docstring for ivy.mish also applies to this method with minimal changes.
- Parameters:
self (
Array
) – input array.out (
Optional
[Array
]) – optional output array, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
Examples
>>> x = ivy.array([-1., 0., 1.]) >>> y = x.mish() >>> print(y) ivy.array([-0.30340147, 0. , 0.86509842])
- Return type:
Array
- Container.mish(self, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)#
ivy.Container instance method variant of ivy.mish. This method simply wraps the function, and so the docstring for ivy.mish also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – a container with the rectified linear activation unit function applied element-wise.
Examples
>>> x = ivy.Container(a=ivy.array([1.0, -1.2]), b=ivy.array([0.4, -0.2])) >>> y = x.mish() >>> print(y) { a: ivy.array([0.86509842, -0.30883577]), b: ivy.array([0.28903052, -0.10714479]) }