hardsilu#
- ivy.hardsilu(x, /, *, out=None)[source]#
Apply the hardsilu/hardswish function element-wise.
- Parameters:
- Return type:
- Returns:
an array containing the output of the hardsilu/hardswish function applied to each element in
x.
Examples
With
ivy.Arrayinput:>>> x = ivy.array([1., 2., 3.]) >>> y = ivy.hardsilu(x) >>> print(y) ivy.array([0.66666669, 1.66666663, 3. ]) >>> x = ivy.array([-2.1241, 1.4897, 4.4090]) >>> y = ivy.zeros(3) >>> ivy.hardsilu(x, out=y) >>> print(y) ivy.array([-0.31008321, 1.1147176 , 4.40899992])
With
ivy.Containerinput:>>> x = ivy.Container(a=ivy.array([-0.5, -1, 0]), b=ivy.array([0.5, 1., 2])) >>> y = ivy.hardsilu(x) >>> print(y) { a: ivy.array([-0.20833333, -0.33333334, 0.]), b: ivy.array([0.29166666, 0.66666669, 1.66666663]) }
- Array.hardsilu(self, out=None)[source]#
ivy.Array instance method which acts as a wrapper for ivy.hardsilu.
- Parameters:
self – input array
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:
an array containing the output of the hardsilu/hardswish function applied
to each element in
x.
Examples
>>> x = ivy.array([1., 2., 3.]) >>> y = x.hardsilu() >>> print(y) ivy.array([0.66666667, 1.66666667, 3.])
- Container.hardsilu(self, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method which acts as a wrapper for ivy.hardsilu.
- Parameters:
self – input container
key_chains (
Optional[Union[List[str],Dict[str,str],Container]], default:None) – The keychains to apply or not apply the method to. Default isNone.to_apply (
Union[bool,Container], default:True) – If True, the method will be applied to key_chains, otherwise key_chains will be skipped. Default isTrue.prune_unapplied (
Union[bool,Container], default:False) – Whether to prune key_chains for which the function was not applied. Default isFalse.map_sequences (
Union[bool,Container], default:False) – Whether to also map method to sequences (lists, tuples). Default isFalse.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:
a container containing the output of the hardsilu/hardswish function applied
to each element in the input container.
Examples
>>> x = ivy.Container(a=ivy.array([-0.5, -1, 0]), b=ivy.array([0.5, 1., 2])) >>> y = x.hardsilu() >>> print(y) { a: ivy.array([-0.20833333, -0.33333334, 0.]), b: ivy.array([0.29166666, 0.66666669, 1.66666663]) }