Experimental#
- class ivy.data_classes.container.experimental.activations._ContainerWithActivationExperimental(dict_in=None, queues=None, queue_load_sizes=None, container_combine_method='list_join', queue_timeout=None, print_limit=10, key_length_limit=None, print_indent=4, print_line_spacing=0, ivyh=None, default_key_color='green', keyword_color_dict=None, rebuild_child_containers=False, types_to_iteratively_nest=None, alphabetical_keys=True, dynamic_backend=None, build_callable=False, **kwargs)[source]#
- _abc_impl = <_abc._abc_data object>#
- static _static_celu(x, /, *, alpha=1.0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, complex_mode='jax', out=None)[source]#
ivy.Container static 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:
x (
Union
[Array
,NativeArray
,Container
]) – input container.alpha (
Container
, default:1.0
) – array or scalar specifying the alpha value for CELU formlation.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
.complex_mode (
Literal
['split'
,'magnitude'
,'jax'
], default:'jax'
) – optional specifier for how to handle complex data types. Seeivy.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 = x = ivy.Container(a=ivy.array([0.39, -0.85]), b=ivy.array([1., -0.2])) >>> y = ivy.Container.static_celu(x) >>> print(y) { a: ivy.array([0.38999999, -0.17]), b: ivy.array([1., -0.04]) }
- static _static_elu(x, /, *, alpha=1.0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.elu. This method simply wraps the function, and so the docstring for ivy.elu also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input container.alpha (
Container
, default:1.0
) – scaler for controlling the slope of the function for x <= 0 Default: 1.0key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
ret – a container with the elu unit function applied element-wise.
Examples
>>> x = x = ivy.Container(a=ivy.array([0.39, -0.85]), b=ivy.array([1., -0.2])) >>> y = ivy.Container.static_elu(x) >>> print(y) { a: ivy.array([0.38999999, -0.57]), b: ivy.array([1., -0.18]) }
- static _static_hardshrink(x, /, *, lambd=0.5, key_chains=None, to_apply=False, prune_unapplied=True, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.hardshrink. This method simply wraps the function, and so the docstring for ivy.hardshrink also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input container.lambd (
Container
, default:0.5
) – Lambda value for hard shrinkage calculation.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains to apply or not apply the method to.to_apply (
Union
[bool
,Container
], default:False
) – If True, the method will be applied to key_chains, otherwise key_chains will be skipped.prune_unapplied (
Union
[bool
,Container
], default:True
) – Whether to prune key_chains for which the function was not applied.map_sequences (
Union
[bool
,Container
], default:False
) – Whether to also map method to sequences (lists, tuples).
- Return type:
Container
- Returns:
ret – Container with hard shrinkage applied to the leaves.
Examples
>>> x = ivy.Container(a=ivy.array([1., -2.]), b=ivy.array([0.4, -0.2])) >>> y = ivy.Container._static_hardshrink(x) >>> print(y) { a: ivy.array([1., -2.]), b: ivy.array([0., 0.]) }
- static _static_hardsilu(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method which acts as a wrapper for ivy.hardsilu.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input containerkey_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
x
.
Examples
>>> x = ivy.Container(a=ivy.array([-0.5, -1, 0]), b=ivy.array([0.5, 1., 2])) >>> y = ivy.Container._static_hardsilu(x) >>> print(y) { a: ivy.array([-0.20833333, -0.33333334, 0.]), b: ivy.array([0.29166666, 0.66666669, 1.66666663]) }
- static _static_hardtanh(x, /, *, min_val=-1.0, max_val=1.0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.hardtanh.This method simply wrap the function,the docstring for ivy.hardtanh also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input container.min_val (
Container
, default:-1.0
) – minimum value of the linear region range. Default: -1.max_val (
Container
, default:1.0
) – maximum value of the linear region range. Default: 1.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
ret – a container with the hardtanh unit function applied element-wise.
Examples
>>> x = x = ivy.Container(a=ivy.array([0.39, -2.0]), b=ivy.array([2., -0.2])) >>> y = ivy.Container._static_hardtanh(x) >>> print(y) { a: ivy.array([0.3899, -1.]), b: ivy.array([1., -0.2]) }
- static _static_scaled_tanh(x, /, *, alpha=1.7159, beta=0.67, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.scaled_tanh. This method simply wraps the function, and so the docstring for ivy.scaled_tanh also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input container.alpha (
Union
[float
,Container
], default:1.7159
) – The scaling parameter for the output. Determines the amplitude of the tanh function. Default: 1.7159beta (
Union
[float
,Container
], default:0.67
) – The scaling parameter for the input. Determines the slope of the tanh function. Default: 0.67key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
ret – a container with the scaled_tanh function applied.
Examples
>>> x = ivy.Container(a=ivy.array([8.931, -0.85]), b=ivy.array([1., -0.2]))) >>> y = ivy.Container._static_scaled_tanh(x) >>> y { a: ivy.array([1.71587813, -0.88367474]), b: ivy.array([1.00376701, -0.2285642]) }
>>> x = ivy.Container(a=ivy.array([8.9, -8.9]), b=ivy.array([3., 33.2])) >>> y = ivy.Container._static_scaled_tanh(x, alpha=2, beta=2.5) >>> y { a: ivy.array([2., -2.]), b: ivy.array([1.99999881, 2.]) }
>>> x = ivy.Container(a=ivy.array([0.3, -0.3]), b=ivy.array([33.0, -33.0])) >>> y = ivy.Container._static_scaled_tanh(x, alpha=1.5, beta=25) >>> y { a: ivy.array([1.49999905, -1.49999905]), b: ivy.array([1.5, -1.5]) }
- static _static_silu(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.silu. This method simply wraps the function, and so the docstring for ivy.silu also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
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 = ivy.Container.static_silu(x) >>> print(y) { a: ivy.array([0.73105854, -0.27777028]), b: ivy.array([0.23947507, -0.0900332]) }
- static _static_softshrink(x, /, *, lambd=0.5, key_chains=None, to_apply=False, prune_unapplied=True, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.softshrink. This method simply wraps the function, and so the docstring for ivy.softshrink also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input container.lambd (
Container
, default:0.5
) – Lambda value for soft shrinkage calculation.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains to apply or not apply the method to.to_apply (
Union
[bool
,Container
], default:False
) – If True, the method will be applied to key_chains, otherwise key_chains will be skipped.prune_unapplied (
Union
[bool
,Container
], default:True
) – Whether to prune key_chains for which the function was not applied.map_sequences (
Union
[bool
,Container
], default:False
) – Whether to also map method to sequences (lists, tuples).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 – Container with soft shrinkage applied to the leaves.
Examples
>>> x = ivy.Container(a=ivy.array([1., -2.]), b=ivy.array([0.4, -0.2])) >>> y = ivy.Container._static_softshrink(x) >>> print(y) { a: ivy.array([0.5, -1.5]), b: ivy.array([0., 0.]) }
- static _static_tanhshrink(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.tanhshrink. This method simply wraps the function, and so the docstring for ivy.tanhshrink also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
ret – a container with the tanhshrink 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 = ivy.Container._static_tanhshrink(x) >>> print(y) { a: ivy.array([0.23840582, -0.36634541]), b: ivy.array([0.02005103, -0.00262468]) }
- static _static_threshold(x, /, *, threshold, value, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.threshold. This method simply wraps the function, and so the docstring for ivy.threshold also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input container.threshold (
Container
) – threshold value for thresholding operation.value (
Container
) – value to replace with if thresholding condition is not met.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains to apply or not apply the method to.to_apply (
Union
[bool
,Container
], default:True
) – If True, the method will be applied to key_chains, otherwise key_chains will be skipped.prune_unapplied (
Union
[bool
,Container
], default:False
) – Whether to prune key_chains for which the function was not applied.map_sequences (
Union
[bool
,Container
], default:False
) – Whether to also map method to sequences (lists, tuples).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 threshold 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._static_threshold(threshold=0.5, value=0.0) >>> print(y) { a: ivy.array([1., 0.]), b: ivy.array([0., 0.]) }
- celu(*, 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 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
.complex_mode (
Literal
['split'
,'magnitude'
,'jax'
], default:'jax'
) – optional specifier for how to handle complex data types. Seeivy.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]) }
- elu(*, alpha=1.0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.elu. This method simply wraps the function, and so the docstring for ivy.elu also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container.alpha (
Container
, default:1.0
) – scaler for controlling the slope of the function for x <= 0 Default: 1.0key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
ret – a container with the elu unit function applied element-wise.
Examples
>>> x = ivy.Container(a=ivy.array([0.39, -0.85]), b=ivy.array([1., -0.2])) >>> y = x.elu() >>> print(y) { a: ivy.array([0.38999999, -0.57]), b: ivy.array([1., -0.18]) }
- hardshrink(*, lambd=0.5, key_chains=None, to_apply=False, prune_unapplied=True, map_sequences=False, out=None)[source]#
Apply the hard shrinkage function element-wise.
- Parameters:
self (
Container
) – Input container.lambd (
Container
, default:0.5
) – Lambda value for hard shrinkage calculation.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains to apply or not apply the method to.to_apply (
Union
[bool
,Container
], default:False
) – If True, the method will be applied to key_chains, otherwise key_chains will be skipped.prune_unapplied (
Union
[bool
,Container
], default:True
) – Whether to prune key_chains for which the function was not applied.map_sequences (
Union
[bool
,Container
], default:False
) – Whether to also map method to sequences (lists, tuples).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 – Container with hard shrinkage applied to the leaves.
Examples
>>> x = ivy.Container(a=ivy.array([1., -2.]), b=ivy.array([0.4, -0.2])) >>> y = ivy.Container.hardshrink(x) >>> print(y) { a: ivy.array([1., -2.]), b: ivy.array([0., 0.]) }
- hardsilu(*, 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]) }
- hardtanh(*, min_val=-1.0, max_val=1.0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.hardtanh.This method simply wraps the function, so the docstring for ivy.elu also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container.min_val (
Container
, default:-1.0
) – minimum value of the linear region range. Default: -1.max_val (
Container
, default:1.0
) – maximum value of the linear region range. Default: 1.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
ret – a container with the hardtanh unit function applied element-wise.
Examples
>>> x = ivy.Container(a=ivy.array([0.39, -2.0]), b=ivy.array([2., -0.2])) >>> y = ivy.Container.hardtanh(x) >>> print(y) { a: ivy.array([0.389999, -1.]), b: ivy.array([1., -0.2]) }
- logit(*, eps=None, complex_mode='jax', out=None)[source]#
ivy.Container instance method variant of ivy.logit. This method simply wraps the function, and so the docstring for ivy.logit also applies to this method with minimal changes.
- Parameters:
self (
Union
[float
,int
,Container
]) – Input container.eps (
Optional
[Union
[float
,Container
]], default:None
) – When eps is None the function outputs NaN where x < 0 or x > 1. and inf or -inf where x = 1 or x = 0, respectively. Otherwise if eps is defined, x is clamped to [eps, 1 - eps]complex_mode (
Literal
['split'
,'magnitude'
,'jax'
], default:'jax'
) – optional specifier for how to handle complex data types. Seeivy.func_wrapper.handle_complex_input
for more detail.out (
Optional
[Container
], default:None
) – Optional output Container.
- Return type:
Container
- Returns:
ret – Container with logits of the leaves.
Examples
>>> a = ivy.array([1, 0, 0.9]) >>> b = ivy.array([0.1, 2, -0.9]) >>> x = ivy.Container(a=a, b=b) >>> z = x.logit() >>> print(z) { a: ivy.array([inf, -inf, 2.19722438]), b: ivy.array([-2.19722462, nan, nan]) }
>>> a = ivy.array([0.3, 2, 0.9]) >>> b = ivy.array([0.1, 1.2, -0.9]) >>> x = ivy.Container(a=a, b=b) >>> z = x.logit(eps=0.2) >>> print(z) { a: ivy.array([-0.84729779, 1.38629448, 1.38629448]), b: ivy.array([-1.38629436, 1.38629448, -1.38629436]) }
- logsigmoid(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, complex_mode='jax')[source]#
Apply element-wise Log-sigmoid of x i.e. log(1 / (1 + exp(-x)).
- Parameters:
self (
Container
) – Input container.complex_mode (
Literal
['split'
,'magnitude'
,'jax'
], default:'jax'
) – optional specifier for how to handle complex data types. Seeivy.func_wrapper.handle_complex_input
for more detail.
- Return type:
Container
- Returns:
ret – Container with Log-sigmoid applied to the leaves.
Examples
>>> x = ivy.Container(a=ivy.array([1.0, -1.2]), b=ivy.array([0.4, -0.2])) >>> y = x.logsigmoid() >>> print(y) { a: ivy.array([-0.31326163, -1.46328258]), b: ivy.array([-0.51301527, -0.79813886]) }
- prelu(slope, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
- Parameters:
slope (
Union
[float
,NativeArray
,Array
,Container
]) –key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) –to_apply (
Union
[bool
,Container
], default:True
) –prune_unapplied (
Union
[bool
,Container
], default:False
) –map_sequences (
Union
[bool
,Container
], default:False
) –out (
Optional
[Container
], default:None
) –
- Return type:
Container
- relu6(*, 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.relu6. This method simply wraps the function, and so the docstring for ivy.relu6 also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
.complex_mode (
Literal
['split'
,'magnitude'
,'jax'
], default:'jax'
) – optional specifier for how to handle complex data types. Seeivy.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 rectified linear 6 activation unit function applied element-wise.
Examples
>>> x = ivy.Container(a = ivy.array([-3., -2., -1., 0., 1., 2., 3., 4., 5.]), ... b= ivy.array([1., 2., 3., 4., 5., 6., 7., 8., 9.])) >>> y = x.relu() >>> print(y) { a: ivy.array([0., 0., 0., 0., 1., 2., 3., 4., 5.]), b: ivy.array([1., 2., 3., 4., 5., 6., 7., 8., 9.]) }
- scaled_tanh(*, alpha=1.7159, beta=0.67, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.scaled_tanh. This method simplywraps the function, and so the docstring for ivy.scaled_tanh also applies to this method with minimal changes.
- Parameters:
x – input container.
alpha (
Union
[float
,Container
], default:1.7159
) – The scaling parameter for the output. Determines the amplitude of the tanh function. Default: 1.7159beta (
Union
[float
,Container
], default:0.67
) – The scaling parameter for the input. Determines the slope of the tanh function. Default: 0.67key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
ret – a container with the scaled_tanh function applied.
Examples
>>> x = ivy.Container(a=ivy.array([2., 3.]), b=ivy.array([1., 2.])) >>> x.scaled_tanh() { a: ivy.array([1.49570239, 1.65537548]), b: ivy.array([1.00376701, 1.49570239]) }
>>> x = ivy.Container(a=ivy.array([1., 1.]), b=ivy.array([1., 1.])) >>> x.scaled_tanh(alpha=30) { a: ivy.array([17.54939651, 17.54939651]), b: ivy.array([17.54939651, 17.54939651]) }
>>> x = ivy.Container(a=ivy.array([20., 21.]), b=ivy.array([3., 1.])) >>> x.scaled_tanh(alpha=0.1, beta=-0.4) { a: ivy.array([-0.09999998, -0.09999999]), b: ivy.array([-0.08336546, -0.0379949]) }
- selu(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.selu. This method simply wraps the function, and so the docstring for ivy.selu also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
ret – a container with the scaled exponential linear unit activation function applied element-wise.
Examples
>>> x = ivy.Container(a=ivy.array([1.0, -1.2]), b=ivy.array([0.4, -0.2])) >>> y = x.selu() >>> print(y) { a: ivy.array([1.05070102, -1.22856998]), b: ivy.array([0.42028043, -0.31868932]) }
- silu(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.silu. This method simply wraps the function, and so the docstring for ivy.silu also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
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.silu() >>> print(y) { a: ivy.array([0.73105854, -0.27777028]), b: ivy.array([0.23947507, -0.0900332]) }
- softshrink(*, lambd=0.5, key_chains=None, to_apply=False, prune_unapplied=True, map_sequences=False, out=None)[source]#
Apply the soft shrinkage function element-wise.
- Parameters:
self (
Container
) – Input container.lambd (
Container
, default:0.5
) – Lambda value for soft shrinkage calculation.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains to apply or not apply the method to.to_apply (
Union
[bool
,Container
], default:False
) – If True, the method will be applied to key_chains, otherwise key_chains will be skipped.prune_unapplied (
Union
[bool
,Container
], default:True
) – Whether to prune key_chains for which the function was not applied.map_sequences (
Union
[bool
,Container
], default:False
) – Whether to also map method to sequences (lists, tuples).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 – Container with soft shrinkage applied to the leaves.
Examples
>>> import ivy.numpy as np >>> x = ivy.Container(a=np.array([1., -2.]), b=np.array([0.4, -0.2])) >>> y = ivy.Container.softshrink(x) >>> print(y) { a: ivy.array([0.5, -1.5]), b: ivy.array([0., 0.]) }
- static static_logit(x, /, *, eps=None, complex_mode='jax', out=None)[source]#
ivy.Container static method variant of ivy.logit. This method simply wraps the function, and so the docstring for ivy.logit also applies to this method with minimal changes.
- Parameters:
x (
Union
[float
,int
,Container
]) – Input container.eps (
Optional
[Union
[float
,Container
]], default:None
) – When eps is None the function outputs NaN where x < 0 or x > 1. and inf or -inf where x = 1 or x = 0, respectively. Otherwise if eps is defined, x is clamped to [eps, 1 - eps]complex_mode (
Literal
['split'
,'magnitude'
,'jax'
], default:'jax'
) – optional specifier for how to handle complex data types. Seeivy.func_wrapper.handle_complex_input
for more detail.out (
Optional
[Container
], default:None
) – Optional output Container.
- Return type:
Container
- Returns:
ret – Container with logits of the leaves.
Examples
>>> a = ivy.array([1, 0, 0.9]) >>> b = ivy.array([0.1, 2, -0.9]) >>> x = ivy.Container(a=a, b=b) >>> z = ivy.Container.static_logit(x) >>> print(z) { a: ivy.array([inf, -inf, 2.19722438]), b: ivy.array([-2.19722462, nan, nan]) }
>>> a = ivy.array([0.3, 2, 0.9]) >>> b = ivy.array([0.1, 1.2, -0.9]) >>> x = ivy.Container(a=a, b=b) >>> z = ivy.Container.static_logit(x, eps=0.2) >>> print(z) { a: ivy.array([-0.84729779, 1.38629448, 1.38629448]), b: ivy.array([-1.38629436, 1.38629448, -1.38629436]) }
- static static_logsigmoid(input, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, complex_mode='jax')[source]#
ivy.Container static method variant of ivy.logsigmoid. This method simply wraps the function, and so the docstring for ivy.logsigmoid also applies to this method with minimal changes.
- Parameters:
input (
Union
[Array
,NativeArray
,Container
]) – Input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
.complex_mode (
Literal
['split'
,'magnitude'
,'jax'
], default:'jax'
) – optional specifier for how to handle complex data types. Seeivy.func_wrapper.handle_complex_input
for more detail.
- Return type:
Container
- Returns:
Container with Log-sigmoid applied to the leaves.
Examples
>>> a = ivy.array([1, 0, 0.9]) >>> b = ivy.array([0.1, 2, -0.9]) >>> x = ivy.Container(a=a, b=b) >>> z = ivy.Container.static_logsigmoid(x) >>> print(z) { a: ivy.array([-0.31326169, -0.69314718, -0.34115386]), b: ivy.array([-0.64439666, -0.126928, -1.24115384]) }
>>> a = ivy.array([0.3, 2.5, 4.9]) >>> b = ivy.array([0.1, 1.2, -9.]) >>> x = ivy.Container(a=a, b=b) >>> z = ivy.Container.static_logsigmoid(x) >>> print(z) { a: ivy.array([-0.55435526, -0.07888974, -0.00741899]), b: ivy.array([-0.64439666, -0.26328245, -9.00012302]) }
- static static_prelu(x, slope, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
- Parameters:
x (
Union
[NativeArray
,Array
,Container
]) –slope (
Union
[float
,NativeArray
,Array
,Container
]) –key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) –to_apply (
Union
[bool
,Container
], default:True
) –prune_unapplied (
Union
[bool
,Container
], default:False
) –map_sequences (
Union
[bool
,Container
], default:False
) –out (
Optional
[Container
], default:None
) –
- Return type:
Container
- static static_relu6(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, complex_mode='jax', out=None)[source]#
ivy.Container static method variant of ivy.relu6. This method simply wraps the function, and so the docstring for ivy.relu6 also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
.complex_mode (
Literal
['split'
,'magnitude'
,'jax'
], default:'jax'
) – optional specifier for how to handle complex data types. Seeivy.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 rectified linear 6 activation unit function applied element-wise.
Examples
>>> x = ivy.Container(a = ivy.array([-3., -2., -1., 0., 1., 2., 3., 4., 5.]), ... b = ivy.array([1., 2., 3., 4., 5., 6., 7., 8., 9.])) >>> y = ivy.Container.static_relu6(x) >>> print(y) { a: ivy.array([0., 0., 0., 0., 1., 2., 3., 4., 5.]), b: ivy.array([1., 2., 3., 4., 5., 6., 6., 6., 6.]) }
- static static_selu(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.selu. This method simply wraps the function, and so the docstring for ivy.selu also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
ret – a container with the scaled exponential linear unit activation function applied element-wise.
Examples
>>> x = ivy.Container(a=ivy.array([1.0, -1.2]), b=ivy.array([0.4, -0.2])) >>> y = ivy.Container.static_selu(x) >>> print(y) { a: ivy.array([1.05070102, -1.22856998]), b: ivy.array([0.42028043, -0.31868932]) }
- static static_thresholded_relu(x, /, *, threshold=0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.thresholded_relu. This method simply wraps the function, and so the docstring for ivy.thresholded_relu also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input container.threshold (
Union
[int
,float
,Container
], default:0
) – threshold value above which the activation is linear. Default:0
.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
ret – a container with the rectified linear activation unit function applied element-wise with custom threshold.
Examples
>>> x = ivy.Container(a=ivy.array([1.0, -1.2]), b=ivy.array([0.4, -0.2])) >>> y = ivy.Container.static_thresholded_relu(x, threshold=0.5) >>> print(y) { a: ivy.array([1., 0.]), b: ivy.array([0., 0.]) }
- tanhshrink(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.tanhshrink. This method simply wraps the function, and so the docstring for ivy.tanhshrink also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
ret – a container with the tanhshrink 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.tanhshrink() >>> print(y) { a: ivy.array([0.23840582, -0.36634541]), b: ivy.array([0.02005103, -0.00262468]) }
- threshold(*, threshold, value, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.threshold. This method simply wraps the function, and so the docstring for ivy.threshold also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container.threshold (
Container
) – threshold value for thresholding operation.value (
Container
) – value to replace with if thresholding condition is not met.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains to apply or not apply the method to.to_apply (
Union
[bool
,Container
], default:True
) – If True, the method will be applied to key_chains, otherwise key_chains will be skipped.prune_unapplied (
Union
[bool
,Container
], default:False
) – Whether to prune key_chains for which the function was not applied.map_sequences (
Union
[bool
,Container
], default:False
) – Whether to also map method to sequences (lists, tuples).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 threshold 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.threshold(threshold=0.5, value=0.0) >>> print(y) { a: ivy.array([1., 0.]), b: ivy.array([0., 0.]) }
- thresholded_relu(*, threshold=0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.thresholded_relu. This method simply wraps the function, and so the docstring for ivy.thresholded_relu also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container.threshold (
Union
[int
,float
,Container
], default:0
) – threshold value above which the activation is linear. Default:0
.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
ret – a container with the rectified linear activation unit function applied element-wise with custom threshold.
Examples
>>> x = ivy.Container(a=ivy.array([1.0, -1.2]), b=ivy.array([0.4, -0.2])) >>> y = x.thresholded_relu(threshold=0.5) >>> print(y) { a: ivy.array([1., 0.]), b: ivy.array([0., 0.]) }
- class ivy.data_classes.container.experimental.conversions._ContainerWithConversionExperimental(dict_in=None, queues=None, queue_load_sizes=None, container_combine_method='list_join', queue_timeout=None, print_limit=10, key_length_limit=None, print_indent=4, print_line_spacing=0, ivyh=None, default_key_color='green', keyword_color_dict=None, rebuild_child_containers=False, types_to_iteratively_nest=None, alphabetical_keys=True, dynamic_backend=None, build_callable=False, **kwargs)[source]#
- _abc_impl = <_abc._abc_data object>#
- class ivy.data_classes.container.experimental.creation._ContainerWithCreationExperimental(dict_in=None, queues=None, queue_load_sizes=None, container_combine_method='list_join', queue_timeout=None, print_limit=10, key_length_limit=None, print_indent=4, print_line_spacing=0, ivyh=None, default_key_color='green', keyword_color_dict=None, rebuild_child_containers=False, types_to_iteratively_nest=None, alphabetical_keys=True, dynamic_backend=None, build_callable=False, **kwargs)[source]#
- _abc_impl = <_abc._abc_data object>#
- static _static_trilu(x, /, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, *, k=0, upper=True, out=None)[source]#
- Return type:
Container
- blackman_window(periodic=True, dtype=None, *, out=None)[source]#
ivy.Container instance method variant of ivy.blackman_window. This method simply wraps the function, and so the docstring for ivy.blackman_window also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container with window sizes.periodic (
bool
, default:True
) – If True, returns a window to be used as periodic function. If False, return a symmetric window.dtype (
Optional
[Union
[Dtype
,NativeDtype
]], default:None
) – The data type to produce. Must be a floating point type.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – The container containing the Blackman windows.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=3, b=5) >>> ivy.blackman_window(x) {a: ivy.array([-1.38777878e-17, 6.30000000e-01, 6.30000000e-01]) b: ivy.array([-1.38777878e-17, 2.00770143e-01, 8.49229857e-01,
8.49229857e-01, 2.00770143e-01])
}
- eye_like(k=0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, *, out=None, dtype=None, device=None)[source]#
ivy.Container instance method variant of ivy.eye_like. This method simply wraps the function, and so the docstring for ivy.eye_like also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input array or container from which to derive the output container shape.k (
Union
[int
,Container
], default:0
) – index of the diagonal. A positive value refers to an upper diagonal, a negative value to a lower diagonal, and 0 to the main diagonal. Default:0
.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
.dtype (
Optional
[Union
[Dtype
,NativeDtype
,Container
]], default:None
) – output array data type. Ifdtype
isNone
, the output container data type must be inferred fromself
. Default:None
.device (
Optional
[Union
[Device
,NativeDevice
,Container
]], default:None
) – device on which to place the created array. If device isNone
, the output container device must be inferred fromself
. Default:None
.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 having the same shape as
x
and filled withones
in diagonalk
andzeros
elsewhere.
Examples
>>> x = ivy.Container(a=ivy.array([3., 8.]), b=ivy.array([2., 2.])) >>> y = x.eye_like() >>> print(y) { a: ivy.array([[1.], [0.]]), b: ivy.array([[1.], [0.]]) }
- hamming_window(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, periodic=True, alpha=0.54, beta=0.46, dtype=None, out=None)[source]#
ivy.Container instance method variant of ivy.hamming_window. This method simply wraps the function, and so the docstring for ivy.hamming_window also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container including window lengths.periodic (
Union
[bool
,Container
], default:True
) – If True, returns a window to be used as periodic function. If False, return a symmetric window.alpha (
Union
[float
,Container
], default:0.54
) – The coefficient alpha in the hamming window equationbeta (
Union
[float
,Container
], default:0.46
) – The coefficient beta in the hamming window equationdtype (
Optional
[Union
[Array
,NativeArray
,Container
]], default:None
) – data type of the returned arrays.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – The container that includes the Hamming windows.
Examples
>>> x = ivy.Container(a=3, b=5)) >>> x.hamming_window(periodic=True, alpha=0.2, beta=2) { a: ivy.array([-1.8000, 1.2000, 1.2000]), b: ivy.array([-1.8000, -0.4180, 1.8180, 1.8180, -0.4180]) }
- hann_window(periodic=True, dtype=None, *, out=None)[source]#
ivy.Container instance method variant of ivy.hann_window. This method simply wraps the function, and so the docstring for ivy.hann_window also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container with window sizes.periodic (
Union
[bool
,Container
], default:True
) – If True, returns a window to be used as periodic function. If False, return a symmetric window.dtype (
Optional
[Union
[Dtype
,NativeDtype
,Container
]], default:None
) – The data type to produce. Must be a floating point type.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – The container containing the Hann windows.
Examples
With one
ivy.Container
input:>>> x = ivy.Container(a=3, b=5) >>> ivy.hann_window(x) { a: ivy.array([0.0000, 0.7500, 0.7500]) b: ivy.array([0.0000, 0.3455, 0.9045, 0.9045, 0.3455]) }
- kaiser_bessel_derived_window(periodic=True, beta=12.0, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, dtype=None, out=None)[source]#
ivy.Container instance method variant of ivy.kaiser_bessel_derived_window. This method simply wraps the function, and so the docstring for ivy.kaiser_bessel_derived_window also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container including window lengths.periodic (
Union
[bool
,Container
], default:True
) – If True, returns a periodic window suitable for use in spectral analysis. If False, returns a symmetric window suitable for use in filter design.beta (
Union
[float
,Container
], default:12.0
) – a float used as shape parameter for the window.dtype (
Optional
[Union
[Array
,NativeArray
,Container
]], default:None
) – data type of the returned array.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – The container that includes the Kaiser Bessel Derived windows.
Examples
>>> x = ivy.Container(a=3, b=5)) >>> x.kaiser_bessel_derived_window(True, 5) { a: ivy.array([0.70710677, 0.70710677]), b: ivy.array([0.18493208, 0.9827513 , 0.9827513 , 0.18493208]), }
- kaiser_window(periodic=True, beta=12.0, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, dtype=None, out=None)[source]#
ivy.Container instance method variant of ivy.kaiser_window. This method simply wraps the function, and so the docstring for ivy.kaiser_window also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container including window lengths.periodic (
Union
[bool
,Container
], default:True
) – If True, returns a periodic window suitable for use in spectral analysis. If False, returns a symmetric window suitable for use in filter design.beta (
Union
[float
,Container
], default:12.0
) – a float used as shape parameter for the window.dtype (
Optional
[Union
[Array
,NativeArray
,Container
]], default:None
) – data type of the returned array.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – The container that includes the Kaiser windows.
Examples
>>> x = ivy.Container(a=3, b=5) >>> ivy.Container.static_kaiser_window(x, True, 5) { a: ivy.array([0.2049, 0.8712, 0.8712]), a: ivy.array([0.0367, 0.7753, 0.7753]), }
- mel_weight_matrix(num_mel_bins, dft_length, sample_rate, lower_edge_hertz=0.0, upper_edge_hertz=3000.0)[source]#
ivy.Container instance method variant of ivy.mel_weight_matrix. This method simply wraps the function, and so the docstring for ivy.mel_weight_matrix also applies to this method with minimal changes.
- Parameters:
num_mel_bins (
int
) – The number of bands in the mel spectrum.dft_length (
int
) – The size of the original DFT obtained from (n_fft / 2 + 1).sample_rate (
int
) – Samples per second of the input signal.lower_edge_hertz (
Optional
[float
], default:0.0
) – Lower bound on the frequencies to be included in the mel spectrum.upper_edge_hertz (
Optional
[float
], default:3000.0
) – The desired top edge of the highest frequency band.
- Returns:
ret – MelWeightMatrix of shape: [frames, num_mel_bins]
- polyval(coeffs, x)[source]#
ivy.Container instance method variant of ivy.polyval. This method simply wraps the function, and so the docstring for ivy.polyval also applies to this method with minimal changes.
Evaluate and return a polynomial at specific given values.
- Parameters:
self (
Container
) – Arbitrary input containercoeffs (
Container
) – Polynomial coefficients (including zero) from highest degree to constant term.x (
Container
) – The value of the indeterminate variable at which to evaluate the polynomial.
- Return type:
Container
- Returns:
ret – Output container containing simplified result of substituting x in the coefficients - final value of polynomial.
- static static_blackman_window(window_length, periodic=True, dtype=None, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.blackman_window. This method simply wraps the function, and so the docstring for ivy.blackman_window also applies to this method with minimal changes.
- Parameters:
window_length (
Union
[int
,Container
]) – container including multiple window sizes.periodic (
bool
, default:True
) – If True, returns a window to be used as periodic function. If False, return a symmetric window.dtype (
Optional
[Union
[Dtype
,NativeDtype
]], default:None
) – The data type to produce. Must be a floating point type.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – The container that contains the Blackman windows.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=3, b=5) >>> ivy.Container.static_blackman_window(x) {a: ivy.array([-1.38777878e-17, 6.30000000e-01, 6.30000000e-01]) b: ivy.array([-1.38777878e-17, 2.00770143e-01, 8.49229857e-01,
8.49229857e-01, 2.00770143e-01])
}
- static static_eye_like(x, /, k=0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, *, out=None, dtype=None, device=None)[source]#
ivy.Container static method variant of ivy.eye_like. This method simply wraps the function, and so the docstring for ivy.eye_like also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input array or container from which to derive the output container shape.k (
Union
[int
,Container
], default:0
) – index of the diagonal. A positive value refers to an upper diagonal, a negative value to a lower diagonal, and 0 to the main diagonal. Default:0
.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
.dtype (
Optional
[Union
[Dtype
,NativeDtype
,Container
]], default:None
) – output array data type. Ifdtype
isNone
, the output container data type must be inferred fromself
. DefaultNone
.device (
Optional
[Union
[Device
,NativeDevice
,Container
]], default:None
) – device on which to place the created array. If device isNone
, the output container device must be inferred fromself
. Default:None
.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 having the same shape as
x
and filled withones
in diagonalk
andzeros
elsewhere.
Examples
>>> x = ivy.Container(a=ivy.array([0., 2.6, -3.5]), b=ivy.array([4.5, -5.3, -0, -2.3])) >>> y = ivy.Container.static_eye_like(x) >>> print(y) { a: ivy.array([[1.]]), b: ivy.array([[1.]]) }
- static static_hamming_window(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, periodic=True, alpha=0.54, beta=0.46, dtype=None, out=None)[source]#
ivy.Container static method variant of ivy.hamming_window. This method simply wraps the function, and so the docstring for ivy.hamming_window also applies to this method with minimal changes.
- Parameters:
x (
Union
[int
,Array
,NativeArray
,Container
]) – input container including window lengths.periodic (
Union
[bool
,Container
], default:True
) – If True, returns a window to be used as periodic function. If False, return a symmetric window.alpha (
Union
[float
,Container
], default:0.54
) – The coefficient alpha in the hamming window equationbeta (
Union
[float
,Container
], default:0.46
) – The coefficient beta in the hamming window equationdtype (
Optional
[Union
[Array
,NativeArray
,Container
]], default:None
) – data type of the returned arrays.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – The container that includes the Hamming windows.
Examples
>>> x = ivy.Container(a=3, b=5) >>> ivy.Container.static_hamming_window(x, periodic=True, alpha=0.2, beta=2) { a: ivy.array([-1.8000, 1.2000, 1.2000]), b: ivy.array([-1.8000, -0.4180, 1.8180, 1.8180, -0.4180]) }
- static static_hann_window(window_length, periodic=True, dtype=None, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.hann_window. This method simply wraps the function, and so the docstring for ivy.hann_window also applies to this method with minimal changes.
- Parameters:
window_length (
Union
[int
,Container
]) – container including multiple window sizes.periodic (
Union
[bool
,Container
], default:True
) – If True, returns a window to be used as periodic function. If False, return a symmetric window.dtype (
Optional
[Union
[Dtype
,NativeDtype
,Container
]], default:None
) – The data type to produce. Must be a floating point type.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – The container that contains the Hann windows.
Examples
With one
ivy.Container
input:>>> x = ivy.Container(a=3, b=5) >>> ivy.Container.static_hann(x) { a: ivy.array([0.0000, 0.7500, 0.7500]) b: ivy.array([0.0000, 0.3455, 0.9045, 0.9045, 0.3455]) }
- static static_kaiser_bessel_derived_window(x, periodic=True, beta=12.0, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, dtype=None, out=None)[source]#
ivy.Container static method variant of ivy.kaiser_bessel_derived_window. This method simply wraps the function, and so the docstring for ivy.kaiser_bessel_derived_window also applies to this method with minimal changes.
- Parameters:
x (
Union
[int
,Array
,NativeArray
,Container
]) – input container including window lengths.periodic (
Union
[bool
,Container
], default:True
) – If True, returns a periodic window suitable for use in spectral analysis. If False, returns a symmetric window suitable for use in filter design.beta (
Union
[float
,Container
], default:12.0
) – a float used as shape parameter for the window.dtype (
Optional
[Union
[Array
,NativeArray
,Container
]], default:None
) – data type of the returned array.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – The container that includes the Kaiser Bessel Derived windows.
Examples
>>> x = ivy.Container(a=3, b=5) >>> ivy.Container.static_kaiser_bessel_derived_window(x, True, 5) { a: ivy.array([0.70710677, 0.70710677]), b: ivy.array([0.18493208, 0.9827513 , 0.9827513 , 0.18493208]), }
- static static_kaiser_window(window_length, periodic=True, beta=12.0, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, dtype=None, out=None)[source]#
ivy.Container static method variant of ivy.kaiser_window. This method simply wraps the function, and so the docstring for ivy.kaiser_window also applies to this method with minimal changes.
- Parameters:
window_length (
Union
[int
,Container
]) – input container including window lengths.periodic (
Union
[bool
,Container
], default:True
) – If True, returns a periodic window suitable for use in spectral analysis. If False, returns a symmetric window suitable for use in filter design.beta (
Union
[float
,Container
], default:12.0
) – a float used as shape parameter for the window.dtype (
Optional
[Union
[Array
,NativeArray
,Container
]], default:None
) – data type of the returned array.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – The container that includes the Kaiser windows.
Examples
>>> x = ivy.Container(a=3, b=5) >>> ivy.Container.static_kaiser_window(x, True, 5) { a: ivy.array([0.2049, 0.8712, 0.8712]), a: ivy.array([0.0367, 0.7753, 0.7753]), }
- static static_mel_weight_matrix(num_mel_bins, dft_length, sample_rate, lower_edge_hertz=0.0, upper_edge_hertz=3000.0, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
ivy.Container instance method variant of ivy.mel_weight_matrix. This method simply wraps the function, and so the docstring for ivy.mel_weight_matrix also applies to this method with minimal changes.
- Parameters:
num_mel_bins (
Union
[int
,Container
]) – The number of bands in the mel spectrum.dft_length (
Union
[int
,Container
]) – The size of the original DFT obtained from (n_fft / 2 + 1).sample_rate (
Union
[int
,Container
]) – Samples per second of the input signal.lower_edge_hertz (
Optional
[Union
[float
,Container
]], default:0.0
) – Lower bound on the frequencies to be included in the mel spectrum.upper_edge_hertz (
Optional
[Union
[float
,Container
]], default:3000.0
) – The desired top edge of the highest frequency band.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
.
- Return type:
Container
- Returns:
ret – MelWeightMatrix of shape: [frames, num_mel_bins]
- static static_polyval(coeffs, x, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
ivy.Container static method variant of ivy.polyval. This method simply wraps the function, and so the docstring for ivy.polyval also applies to this method with minimal changes.
Evaluate and return a polynomial at specific given values.
- Parameters:
coeffs (
Container
) – Polynomial coefficients (including zero) from highest degree to constant term.x (
Union
[Container
,int
,float
]) – The value of the indeterminate variable at which to evaluate the polynomial.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]], default:None
) – The key-chains to apply or not apply the method to. Default isNone
.to_apply (
bool
, default:True
) – If True, the method will be applied to key_chains, otherwise key_chains will be skipped. Default isTrue
.prune_unapplied (
bool
, default:False
) – Whether to prune key_chains for which the function was not applied. Default isFalse
.map_sequences (
bool
, default:False
) – Whether to also map method to sequences (lists, tuples). Default isFalse
.
- Return type:
Container
- Returns:
ret – Output container containing simplified result of substituting x in the coefficients - final value of polynomial.
- static static_tril_indices(n_rows, n_cols=None, k=0, /, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, *, device=None)[source]#
- Return type:
Container
- static static_unsorted_segment_mean(data, segment_ids, num_segments, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
Compute the mean of values in the input data based on segment identifiers.
- Parameters:
data (ivy.Container) – Input array or container from which to gather the input.
segment_ids (ivy.Container) – An array of integers indicating the segment identifier for each element in ‘data’.
num_segments (Union[int, ivy.Container]) – An integer or array representing the total number of distinct segment IDs.
key_chains (Optional[Union[List[str], Dict[str, str], ivy.Container]], optional) – The key-chains to apply or not apply the method to. Default is None.
to_apply (Union[bool, ivy.Container], optional) – If True, the method will be applied to key-chains, otherwise key-chains will be skipped. Default is True.
prune_unapplied (Union[bool, ivy.Container], optional) – Whether to prune key-chains for which the function was not applied. Default is False.
map_sequences (Union[bool, ivy.Container], optional) – Whether to also map method to sequences (lists, tuples). Default is False.
- Return type:
Container
- Returns:
ivy.Container – A container representing the result of a segmented mean operation. For each segment, it computes the mean of values in ‘data’ where ‘segment_ids’ equals the segment ID.
- static static_unsorted_segment_min(data, segment_ids, num_segments, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
ivy.Container instance method variant of ivy.unsorted_segment_min. This method simply wraps the function, and so the docstring for ivy.unsorted_segment_min also applies to this method with minimal changes.
Note
If the given segment ID i is negative, then the corresponding value is dropped, and will not be included in the result.
- Parameters:
data (
Container
) – input array or container from which to gather the input.segment_ids (
Container
) – Must be in the same size with the first dimension of data. Has to be of integer data type. The index-th element of segment_ids array is the segment identifier for the index-th element of data.num_segments (
Union
[int
,Container
]) – An integer or array representing the total number of distinct segment IDs.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
.
- Return type:
Container
- Returns:
ret – A container, representing the result of a segmented min operation. For each segment, it computes the min value in data where segment_ids equals to segment ID.
- static static_unsorted_segment_sum(data, segment_ids, num_segments, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
ivy.Container instance method variant of ivy.unsorted_segment_sum. This method simply wraps the function, and so the docstring for ivy.unsorted_segment_sum also applies to this method with minimal changes.
- Parameters:
data (
Container
) – input array or container from which to gather the input.segment_ids (
Container
) – Must be in the same size with the first dimension of data. Has to be of integer data type. The index-th element of segment_ids array is the segment identifier for the index-th element of data.num_segments (
Union
[int
,Container
]) – An integer or array representing the total number of distinct segment IDs.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
.
- Return type:
Container
- Returns:
ret – A container, representing the result of a segmented sum operation. For each segment, it computes the sum of values in data where segment_ids equals to segment ID.
- static static_vorbis_window(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, dtype=None, out=None)[source]#
ivy.Container static method variant of ivy.vorbis_window. This method simply wraps the function, and so the docstring for ivy.vorbis_window also applies to this method with minimal changes.
- Parameters:
x (
Union
[int
,Array
,NativeArray
,Container
]) – input container including window lengths.dtype (
Optional
[Union
[Array
,NativeArray
,Container
]], default:None
) – data type of the returned arrays.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – The container that includes the vorbis windows.
Examples
>>> x = ivy.Container(a=3, b=5) >>> ivy.Container.static_vorbis_window(x) { a: ivy.array([0., 0.38268343, 0.92387953, 1., 0.92387953, 0.38268343]), b: ivy.array([0., 0.14943586, 0.51644717, 0.85631905, 0.98877142, 1., 0.98877142, 0.85631905, 0.51644717, 0.14943586]) }
- tril_indices(n_rows, n_cols=None, k=0, /, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, *, device=None)[source]#
- Return type:
Container
- trilu(key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, *, k=0, upper=True, out=None)[source]#
- Return type:
Container
- unsorted_segment_mean(segment_ids, num_segments)[source]#
Compute the mean of values in the input array or container based on segment identifiers.
- Parameters:
self (ivy.Container) – Input array or container from which to gather the input.
segment_ids (ivy.Container) – An array of integers indicating the segment identifier for each element in ‘self’.
num_segments (Union[int, ivy.Container]) – An integer or array representing the total number of distinct segment IDs.
- Return type:
Container
- Returns:
ivy.Container – A container representing the result of a segmented mean operation. For each segment, it computes the mean of values in ‘self’ where ‘segment_ids’ equals the segment ID.
Example
>>> data = ivy.Container(a=ivy.array([0., 1., 2., 4.]), ... b=ivy.array([3., 4., 5., 6.])) >>> segment_ids = ivy.array([0, 0, 1, 1]) >>> num_segments = 2 >>> result = ivy.unsorted_segment_mean(data, segment_ids, num_segments) >>> print(result) { a: ivy.array([0.5, 3.0]), b: ivy.array([3.5, 5.5]) }
>>> data = ivy.Container(a=ivy.array([0., 1., 2., 4., 5., 6.]), ... b=ivy.array([3., 4., 5., 6., 7., 8.])) >>> segment_ids = ivy.array([0, 0, 1, 1, 2, 2]) >>> num_segments = 3 >>> result = ivy.unsorted_segment_mean(data, segment_ids, num_segments) >>> print(result) { a: ivy.array([0.5, 3.0, 5.5]), b: ivy.array([3.5, 5.5, 7.5]) }
- unsorted_segment_min(segment_ids, num_segments)[source]#
ivy.Container instance method variant of ivy.unsorted_segment_min. This method simply wraps the function, and so the docstring for ivy.unsorted_segment_min also applies to this method with minimal changes.
Note
If the given segment ID i is negative, then the corresponding value is dropped, and will not be included in the result.
- Parameters:
self (
Container
) – input array or container from which to gather the input.segment_ids (
Container
) – Must be in the same size with the first dimension of self. Has to be of integer data type. The index-th element of segment_ids array is the segment identifier for the index-th element of self.num_segments (
Union
[int
,Container
]) – An integer or array representing the total number of distinct segment IDs.
- Returns:
ret – A container, representing the result of a segmented min operation. For each segment, it computes the min value in self where segment_ids equals to segment ID.
- unsorted_segment_sum(segment_ids, num_segments)[source]#
ivy.Container instance method variant of ivy.unsorted_segment_sum. This method simply wraps the function, and so the docstring for ivy.unsorted_segment_sum also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input array or container from which to gather the input.segment_ids (
Container
) – Must be in the same size with the first dimension of self. Has to be of integer data type. The index-th element of segment_ids array is the segment identifier for the index-th element of self.num_segments (
Union
[int
,Container
]) – An integer or array representing the total number of distinct segment IDs.
- Returns:
ret – A container, representing the result of a segmented sum operation. For each segment, it computes the sum of values in self where segment_ids equals to segment ID.
- vorbis_window(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, dtype=None, out=None)[source]#
ivy.Container instance method variant of ivy.vorbis_window. This method simply wraps the function, and so the docstring for ivy.vorbis_window also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container including window lengths.dtype (
Optional
[Union
[Array
,NativeArray
,Container
]], default:None
) – data type of the returned arrays.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – The container that includes the vorbis windows.
Examples
>>> x = ivy.Container(a=3, b=5)) >>> x.vorbis_window() { a: ivy.array([0., 0.38268343, 0.92387953, 1., 0.92387953, 0.38268343]), b: ivy.array([0., 0.14943586, 0.51644717, 0.85631905, 0.98877142, 1., 0.98877142, 0.85631905, 0.51644717, 0.14943586]) }
- class ivy.data_classes.container.experimental.data_type._ContainerWithData_typeExperimental(dict_in=None, queues=None, queue_load_sizes=None, container_combine_method='list_join', queue_timeout=None, print_limit=10, key_length_limit=None, print_indent=4, print_line_spacing=0, ivyh=None, default_key_color='green', keyword_color_dict=None, rebuild_child_containers=False, types_to_iteratively_nest=None, alphabetical_keys=True, dynamic_backend=None, build_callable=False, **kwargs)[source]#
- _abc_impl = <_abc._abc_data object>#
- class ivy.data_classes.container.experimental.device._ContainerWithDeviceExperimental(dict_in=None, queues=None, queue_load_sizes=None, container_combine_method='list_join', queue_timeout=None, print_limit=10, key_length_limit=None, print_indent=4, print_line_spacing=0, ivyh=None, default_key_color='green', keyword_color_dict=None, rebuild_child_containers=False, types_to_iteratively_nest=None, alphabetical_keys=True, dynamic_backend=None, build_callable=False, **kwargs)[source]#
- _abc_impl = <_abc._abc_data object>#
- class ivy.data_classes.container.experimental.elementwise._ContainerWithElementWiseExperimental(dict_in=None, queues=None, queue_load_sizes=None, container_combine_method='list_join', queue_timeout=None, print_limit=10, key_length_limit=None, print_indent=4, print_line_spacing=0, ivyh=None, default_key_color='green', keyword_color_dict=None, rebuild_child_containers=False, types_to_iteratively_nest=None, alphabetical_keys=True, dynamic_backend=None, build_callable=False, **kwargs)[source]#
- _abc_impl = <_abc._abc_data object>#
- allclose(x2, /, *, rtol=1e-05, atol=1e-08, equal_nan=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.allclose. This method simply wraps the function, and so the docstring for ivy.allclose also applies to this method with minimal changes.
- Parameters:
self (
Container
) – Input container containing first input array.x2 (
Container
) – Input container containing second input array.rtol (
Union
[float
,Container
], default:1e-05
) – The relative tolerance parameter.atol (
Union
[float
,Container
], default:1e-08
) – The absolute tolerance parameter.equal_nan (
Union
[bool
,Container
], default:False
) – Whether to compare NaN’s as equal. If True, NaN’s in x1 will be considered equal to NaN’s in x2 in the output array.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
) – Alternate output array in which to place the result. The default is None.
- Return type:
Container
- Returns:
ret – A new container holding the result is returned unless out is specified, in which it is returned.
Examples
>>> x1 = ivy.Container(a=ivy.array([1., 2., 3.]), b=ivy.array([1., 2., 3.])) >>> x2 = ivy.Container(a=ivy.array([1., 2., 3.]), b=ivy.array([1., 2., 3.])) >>> y = x1.allclose(x2) >>> print(y) { a: ivy.array(True), b: ivy.array(True) }
>>> x1 = ivy.Container(a=ivy.array([1., 2., 3.]), ... b=ivy.array([1., 2., 3.])) >>> x2 = ivy.Container(a=ivy.array([1., 2., 3.0003]), ... b=ivy.array([1.0006, 2., 3.])) >>> y = x1.allclose(x2, rtol=1e-3) >>> print(y) { a: ivy.array(True), b: ivy.array(True) }
- amax(*, axis=None, keepdims=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.amax. This method simply wraps the function, and so the docstring for ivy.amax also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container. Should have a real-valued data type.axis (
Optional
[Union
[int
,Sequence
[int
],Container
]], default:None
) – axis or axes along which maximum values must be computed. By default, the maximum value must be computed over the entire array. If a tuple of integers, maximum values must be computed over multiple axes. Default:None
.keepdims (
Union
[bool
,Container
], default:False
) – optional boolean, ifTrue
, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see `broadcasting<https://data-apis.org/array-api/ latest/API_specification/ broadcasting.html#broadcasting>`_). Otherwise, ifFalse
, the reduced axes (dimensions) must not be included in the result. Default:False
.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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, for writing the result to. It must have a shape that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – container, if the maximum value was computed over the entire array, a zero-dimensional array containing the maximum value; otherwise, a non-zero-dimensional array containing the maximum values. The returned array must have the same data type as
x
.
Examples
With
ivy.Container
input:>>> x = ivy.Container(a=ivy.array([1, 2, 3]), ... b=ivy.array([2, 3, 4])) >>> y = x.amax() >>> print(y) { a: ivy.array(3), b: ivy.array(4) }
>>> x = ivy.Container(a=ivy.array([[1, 2, 3], [-1, 0, 2]]), ... b=ivy.array([[2, 3, 4], [0, 1, 2]])) >>> y = x.amax(axis=1) >>> print(y) { a:ivy.array([3, 2]), b:ivy.array([4, 2]) }
- amin(*, axis=None, keepdims=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.amin. This method simply wraps the function, and so the docstring for ivy.amin also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container. Should have a real-valued data type.axis (
Optional
[Union
[int
,Sequence
[int
],Container
]], default:None
) – axis or axes along which minimum values must be computed. By default, the minimum value must be computed over the entire array. If a tuple of integers, minimum values must be computed over multiple axes. Default:None
.keepdims (
Union
[bool
,Container
], default:False
) – optional boolean, ifTrue
, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see `broadcasting<https://data-apis.org/array-api/latest/ API_specification/broadcasting.html#broadcasting>`_). Otherwise, ifFalse
, the reduced axes (dimensions) must not be included in the result. Default:False
.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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, for writing the result to. It must have a shape that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – container, if the minimum value was computed over the entire array, a zero-dimensional array containing the minimum value; otherwise, a non-zero-dimensional array containing the minimum values. The returned array must have the same data type as
x
.
Examples
With
ivy.Container
input:>>> x = ivy.Container(a=ivy.array([1, 2, 3]), ... b=ivy.array([2, 3, 4])) >>> y = x.amin() >>> print(y) { a: ivy.array(1), b: ivy.array(2) }
>>> x = ivy.Container(a=ivy.array([[1, 2, 3], [-1, 0, 2]]), ... b=ivy.array([[2, 3, 4], [0, 1, 2]])) >>> y = x.amin(axis=1) >>> print(y) { a:ivy.array([1, -1]), b:ivy.array([2, 0]) }
- binarizer(*, threshold=0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
Map the values of the input tensor to either 0 or 1, element-wise, based on the outcome of a comparison against a threshold value.
- Parameters:
threshold (
Union
[float
,Container
], default:0
) – Values greater than this are mapped to 1, others to 0.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:
ret – Binarized output data
- conj(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.conj. This method simply wraps the function, and so the docstring for ivy.conj also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
ret – a container containing output array(s) of the same dtype as the input array(s) with the complex conjugates of the complex values present in the input array. If x is a container of scalar(s) then a container of scalar(s) will be returned.
Examples
>>> x = ivy.Container(a=ivy.array([-1j, 0.335+2.345j, 1.23+7j]), b=ivy.array([0.0, 1.2+3.3j, 1+0j])) >>> x.conj() { a: ivy.array([1j, 0.335-2345j, 1.23-7j]), b: ivy.array([0.0, 1.2-3.3j, 1-0j]) }
- copysign(x2, /, *, out=None)[source]#
ivy.Container instance method variant of ivy.copysign. This method simply wraps the function, and so the docstring for ivy.copysign also applies to this method with minimal changes.
- Parameters:
self (
Container
) – Container to change the sign ofx2 (
Container
) – Container from which the new signs are applied Unsigned zeroes are considered positive.out (
Optional
[Container
], default:None
) – optional output Container, for writing the result to.
- Return type:
Container
- Returns:
ret – x1 with the signs of x2. This is a scalar if both x1 and x2 are scalars.
Examples
>>> x1 = ivy.Container(a=ivy.array([0,1,2]), b=ivy.array(-1)) >>> x2 = ivy.Container(a=-1, b=ivy.array(10)) >>> x1.copysign(x2) { a: ivy.array([-0., -1., -2.]), b: ivy.array(1.) } >>> x1.copysign(-1) { a: ivy.array([-0., -1., -2.]), b: ivy.array(-1.) }
- count_nonzero(*, axis=None, keepdims=False, dtype=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.count_nonzero. This method simply wraps the function, and so the docstring for ivy.count_nonzero also applies to this method with minimal changes.
- Parameters:
self (
Container
) – container with the base input arrays.axis (
Optional
[Union
[int
,Tuple
[int
,...
],Container
]], default:None
) – optional axis or tuple of axes along which to count non-zeros. Default is None, meaning that non-zeros will be counted along a flattened version of the input array.keepdims (
Union
[bool
,Container
], default:False
) – optional, if this is set to True, the axes that are counted are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.dtype (
Optional
[Union
[Dtype
,NativeDtype
,Container
]], default:None
) – optional output dtype. Default is of type integer.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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.
- Return type:
Container
- Returns:
ret – Container including number of non-zero values in the array along a given axis. Otherwise, container with the total number of non-zero values in the array is returned.
Examples
>>> x = ivy.Container(a=ivy.array([[0, 1, 2, 3],[4, 5, 6, 7]]), b=ivy.array([[[0,1],[2,3]],[[4,5],[6,7]]])) >>> x.count_nonzero() { a: ivy.array(7), b: ivy.array(7) } >>> x = ivy.Container(a=ivy.array([[0, 1, 2, 3],[4, 5, 6, 7]]), b=ivy.array([[[0,1],[2,3]],[[4,5],[6,7]]])) >>> x.count_nonzero(axis=0) { a: ivy.array([1, 2, 2, 2]), b: ivy.array([[1, 2], [2, 2]]) } >>> x = ivy.Container(a=ivy.array([[0, 1, 2, 3],[4, 5, 6, 7]]), b=ivy.array([[[0,1],[2,3]],[[4,5],[6,7]]])) >>> x.count_nonzero(axis=(0,1), keepdims=True) { a: ivy.array([[7]]), b: ivy.array([[[3, 4]]]) }
- diff(*, n=1, axis=-1, prepend=None, append=None, out=None)[source]#
ivy.Container instance method variant of ivy.diff. This method simply wraps the function, and so the docstring for ivy.diff also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container with array-like items.n (
Union
[int
,Container
], default:1
) – The number of times values are differenced. If zero, the input is returned as-is.axis (
Union
[int
,Container
], default:-1
) – The axis along which the difference is taken, default is the last axis.prepend (
Optional
[Union
[Array
,NativeArray
,int
,list
,tuple
,Container
]], default:None
) – Values to prepend/append to x along given axis prior to performing the difference. Scalar values are expanded to arrays with length 1 in the direction of axis and the shape of the input array in along all other axes. Otherwise the dimension and shape must match x except along axis.append (
Optional
[Union
[Array
,NativeArray
,int
,list
,tuple
,Container
]], default:None
) – Values to prepend/append to x along given axis prior to performing the difference. Scalar values are expanded to arrays with length 1 in the direction of axis and the shape of the input array in along all other axes. Otherwise the dimension and shape must match x except along axis.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – Container including arrays with the n-th discrete difference along the given axis.
Examples
>>> x = ivy.Container(a=ivy.array([1, 2, 4, 7, 0]), b=ivy.array([1, 2, 4, 7, 0])) >>> x.diff() { a: ivy.array([1, 2, 3, -7]), b: ivy.array([1, 2, 3, -7]) }
- digamma(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.digamma. This method simply wraps the function, and so the docstring for ivy.digamma also applies to this method with minimal changes.
Note
The Ivy version only accepts real-valued inputs.
- Parameters:
self (
Container
) – Input container containing input arrays.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]], default:None
) – The key-chains to apply or not apply the method to. Default isNone
.to_apply (
bool
, default:True
) – If True, the method will be applied to key_chains, otherwise key_chains will be skipped. Default isTrue
.prune_unapplied (
bool
, default:False
) – Whether to prune key_chains for which the function was not applied. Default isFalse
.map_sequences (
bool
, default:False
) – Whether to also map method to sequences (lists, tuples). Default isFalse
.out (
Optional
[Container
], default:None
) – Alternate output array in which to place the result. The default is None.
- Return type:
Container
- Returns:
ret – container including the digamma function computed element-wise
Examples
>>> x = ivy.Container(a=ivy.array([1, 0.5]), b=ivy.array([2.0, 3.0]) >>> x.digamma() { a: ivy.array([-0.5772, -1.9635]), b: ivy.array([0.4228, 0.9228]) }
- erfc(*, out=None)[source]#
ivy.Container instance method variant of ivy.erfc. This method simply wraps the function, and so the docstring for ivy.erfc also applies to this method with minimal changes.
- Parameters:
self (
Container
) – The container whose array contains real or complex valued argument.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – container with values of the complementary error function.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=ivy.array([1., 2., 3.]), b=ivy.array([-1., -2., -3.])) >>> x.erfc() {a: ivy.array([1.57299206e-01, 4.67773480e-03, 2.20904985e-05]), b: ivy.array([1.84270084, 1.99532223, 1.99997795])
}
- erfinv(*, out=None)[source]#
ivy.Container instance method variant of ivy.erfinv. This method simply wraps the function, and so the docstring for ivy.erfinv also applies to this method with minimal changes.
- Parameters:
self (
Container
) – The container whose array contains real or complex valued argument.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – container with values of the inverse error function.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=ivy.array([1., 2., 3.]), b=ivy.array([-1., -2., -3.])) >>> x.erfinv() {a: ivy.array([1.57299206e-01, 4.67773480e-03, 2.20904985e-05]), b: ivy.array([1.84270084, 1.99532223, 1.99997795])
}
- fix(*, out=None)[source]#
ivy.Container instance method variant of ivy.fix. This method simply wraps the function, and so the docstring for ivy.fix also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container with array items.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – Container including arrays with element-wise rounding of input arrays elements.
Examples
>>> x = ivy.Container(a=ivy.array([2.1, 2.9, -2.1]), b=ivy.array([3.14])) >>> x.fix() { a: ivy.array([ 2., 2., -2.]) b: ivy.array([ 3.0 ]) }
- float_power(x2, /, *, out=None)[source]#
ivy.Container instance method variant of ivy.float_power. This method simply wraps the function, and so the docstring for ivy.float_power also applies to this method with minimal changes.
- Parameters:
self (
Container
) – container with the base input arrays.x2 (
Container
) – container with the exponent input arraysout (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – Container including arrays with base arrays raised to the powers of exponents arrays, element-wise .
Examples
>>> x1 = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([2, 10])) >>> x2 = ivy.Container(a=ivy.array([1, 3, 1]), b=0) >>> x1.float_power(x2) { a: ivy.array([1, 8, 3]) b: ivy.array([1, 1]) }
- fmax(x2, /, *, out=None)[source]#
ivy.Container instance method variant of ivy.fmax. This method simply wraps the function, and so the docstring for ivy.fmax also applies to this method with minimal changes.
- Parameters:
self (
Container
) – container with the first input arrays.x2 (
Container
) – container with the second input arraysout (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – Container including arrays with element-wise maximums.
Examples
>>> x1 = ivy.Container(a=ivy.array([2, 3, 4]), b=ivy.array([ivy.nan, 0, ivy.nan])) >>> x2 = ivy.Container(a=ivy.array([1, 5, 2]), b=ivy.array([0, ivy.nan, ivy.nan])) >>> x1.fmax(x2) { a: ivy.array([ 2., 5., 4.]) b: ivy.array([ 0, 0, nan]) }
- fmod(x2, /, *, out=None)[source]#
ivy.Container instance method variant of ivy.fmod. This method simply wraps the function, and so the docstring for ivy.fmod also applies to this method with minimal changes.
- Parameters:
self (
Container
) – container with the first input arrays.x2 (
Container
) – container with the second input arraysout (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – Container including arrays with element-wise remainder of divisions.
Examples
>>> x1 = ivy.Container(a=ivy.array([2, 3, 4]), b=ivy.array([ivy.nan, 0, ivy.nan])) >>> x2 = ivy.Container(a=ivy.array([1, 5, 2]), b=ivy.array([0, ivy.nan, ivy.nan])) >>> x1.fmod(x2) { a: ivy.array([ 0, 3, 0]) b: ivy.array([ nan, nan, nan]) }
- frexp(*, out=None)[source]#
ivy.Container instance method variant of ivy.frexp. This method simply wraps the function, and so the docstring for ivy.frexp also applies to this method with minimal changes.
- Parameters:
self (
Container
) – The container whose arrays should be split into mantissa and exponent.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – container including the mantissa and exponent of x.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([1, 5, 10])) >>> x.frexp() {a: (ivy.array([0.5, 0.5, 0.75]), ivy.array([1, 1, 2])), b: (ivy.array([0.5, 0.625, 0.625]), ivy.array([1, 3, 4]))
}
- gradient(*, spacing=1, edge_order=1, axis=None)[source]#
Calculate gradient of x with respect to (w.r.t.) spacing.
- Parameters:
x – input array representing outcomes of the function spacing if not given, indices of x will be used if scalar indices of x will be scaled with this value if array gradient of x w.r.t. spacing
edge_order (
Union
[int
,Container
], default:1
) – 1 or 2, for ‘frist order’ and ‘second order’ estimation of boundary values of gradient respectively.axis (
Optional
[Union
[int
,list
,tuple
,Container
]], default:None
) – dimension(s) to approximate the gradient over. By default, partial gradient is computed in every dimension
- Return type:
Container
- Returns:
ret – Array with values computed from gradient function from inputs
Examples
>>> coordinates = ivy.Container( >>> a=(ivy.array([-2., -1., 1., 4.]),), >>> b=(ivy.array([2., 1., -1., -4.]),) >>> ) >>> values = ivy.Container( >>> a=ivy.array([4., 1., 1., 16.]), >>> b=ivy.array([4., 1., 1., 16.]) >>> ) >>> ivy.gradient(values, spacing=coordinates) { a: ivy.array([-3., -2., 2., 5.]), b: ivy.array([3., 2., -2., -5.]) }
>>> values = ivy.Container( >>> a=ivy.array([[1, 2, 4, 8], [10, 20, 40, 80]]), >>> b=ivy.array([[-1, -2, -4, -8], [-10, -20, -40, -80]]) >>> ) >>> ivy.gradient(values) [{ a: ivy.array([[9., 18., 36., 72.], [9., 18., 36., 72.]]), b: ivy.array([[-9., -18., -36., -72.], [-9., -18., -36., -72.]]) }, { a: ivy.array([[1., 1.5, 3., 4.], [10., 15., 30., 40.]]), b: ivy.array([[-1., -1.5, -3., -4.], [-10., -15., -30., -40.]]) }]
>>> values = ivy.Container( >>> a=ivy.array([[1, 2, 4, 8], [10, 20, 40, 80]]), >>> b=ivy.array([[-1, -2, -4, -8], [-10, -20, -40, -80]]) >>> ) >>> ivy.gradient(values, spacing=2.0) [{ a: ivy.array([[4.5, 9., 18., 36.], [4.5, 9., 18., 36.]]), b: ivy.array([[-4.5, -9., -18., -36.], [-4.5, -9., -18., -36.]]) }, { a: ivy.array([[0.5, 0.75, 1.5, 2.], [5., 7.5, 15., 20.]]), b: ivy.array([[-0.5, -0.75, -1.5, -2.], [-5., -7.5, -15., -20.]]) }]
>>> values = ivy.Container( >>> a=ivy.array([[1, 2, 4, 8], [10, 20, 40, 80]]), >>> b=ivy.array([[-1, -2, -4, -8], [-10, -20, -40, -80]]) >>> ) >>> ivy.gradient(values, axis=1) { a: ivy.array([[1., 1.5, 3., 4.], [10., 15., 30., 40.]]), b: ivy.array([[-1., -1.5, -3., -4.], [-10., -15., -30., -40.]]) }
>>> values = ivy.Container( >>> a=ivy.array([[1, 2, 4, 8], [10, 20, 40, 80]]), >>> b=ivy.array([[-1, -2, -4, -8], [-10, -20, -40, -80]]) >>> ) >>> ivy.gradient(values, spacing = [3., 2.]) [{ a: ivy.array([[3., 6., 12., 24.], [3., 6., 12., 24.]]), b: ivy.array([[-3., -6., -12., -24.], [-3., -6., -12., -24.]]) }, { a: ivy.array([[0.5, 0.75, 1.5, 2.], [5., 7.5, 15., 20.]]), b: ivy.array([[-0.5, -0.75, -1.5, -2.], [-5., -7.5, -15., -20.]]) }]
>>> coords = ivy.Container( >>> a=(ivy.array([0, 2]), ivy.array([0, 3, 6, 9])), >>> b=(ivy.array([0, -2]), ivy.array([0, -3, -6, -9])) >>>) >>> values = ivy.Container( >>> a=ivy.array([[1, 2, 4, 8], [10, 20, 40, 80]]), >>> b=ivy.array([[-1, -2, -4, -8], [-10, -20, -40, -80]]) >>>) >>> ivy.gradient(values, spacing = coords) [{ a: ivy.array([[4.5, 9., 18., 36.], [4.5, 9., 18., 36.]]), b: ivy.array([[4.5, 9., 18., 36.], [4.5, 9., 18., 36.]]) }, { a: ivy.array([[0.33333333, 0.5, 1., 1.33333333], [3.33333333, 5., 10., 13.33333333]]), b: ivy.array([[0.33333333, 0.5, 1., 1.33333333], [3.33333333, 5., 10., 13.33333333]]) }]
- hypot(x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.hypot. This method simply wraps the function, and so the docstring for ivy.hypot also applies to this method with minimal changes.
- Parameters:
self (
Container
) – Input container containing first input array.x2 (
Container
) – Input container containing second input array.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
) – Alternate output array in which to place the result. The default is None.
- Return type:
Container
- Returns:
ret – container including the hypot function computed element-wise
Examples
>>> x = ivy.Container(a=ivy.array([2.0]), ... b=ivy.array([3.0])) >>> y = ivy.Container(a=ivy.array([3.0]), b=ivy.array([4.0])) >>> x.hypot(y) { a: ivy.array([3.6055]), b: ivy.array([5.]) }
- isclose(b, /, *, rtol=1e-05, atol=1e-08, equal_nan=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.isclose. This method simply wraps the function, and so the docstring for ivy.isclose also applies to this method with minimal changes.
- Parameters:
self (
Container
) – Input container containing first input array.b (
Container
) – Input container containing second input array.rtol (
Union
[float
,Container
], default:1e-05
) – The relative tolerance parameter.atol (
Union
[float
,Container
], default:1e-08
) – The absolute tolerance parameter.equal_nan (
Union
[bool
,Container
], default:False
) – Whether to compare NaN’s as equal. If True, NaN’s in a will be considered equal to NaN’s in b in the output array.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
) – Alternate output array in which to place the result. The default is None.
- Return type:
Container
- Returns:
ret – A new array holding the result is returned unless out is specified, in which it is returned.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=ivy.array([1.0, ivy.nan]), b=ivy.array([1.0, ivy.nan])) >>> y = ivy.Container(a=ivy.array([1.0, ivy.nan]), b=ivy.array([1.0, ivy.nan])) >>> x.isclose(y) {a: ivy.array([True, False]), b: ivy.array([True, False])
} >>> x.isclose(y, equal_nan=True) {
a: ivy.array([True, True]), b: ivy.array([True, True])
} >>> x = ivy.Container(a=ivy.array([1.0, 2.0]), b=ivy.array([1.0, 2.0])) >>> y = ivy.Container(a=ivy.array([1.0, 2.001]), b=ivy.array([1.0, 2.0])) >>> x.isclose(y, atol=0.0) {
a: ivy.array([True, False]), b: ivy.array([True, True])
} >>> x.isclose(y, rtol=0.01, atol=0.0) {
a: ivy.array([True, True]), b: ivy.array([True, True])
}
- ldexp(x2, /, *, out=None)[source]#
ivy.Container instance method variant of ivy.ldexp. This method simply wraps the function, and so the docstring for ivy.ldexp also applies to this method with minimal changes.
- Parameters:
self (
Container
) – The container whose arrays should be multiplied by 2**x2.x2 (
Union
[Array
,NativeArray
,Container
]) – The container whose arrays should be used to multiply x1 by 2**x2.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – container including x1 * 2**x2.
Examples
With one
ivy.Container
input: >>> x1 = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([1, 5, 10])) >>> x2 = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([1, 5, 10])) >>> x1.ldexp(x2) {a: ivy.array([2, 8, 24]), b: ivy.array([2, 160, 10240])
}
- lerp(end, weight, /, *, out=None)[source]#
ivy.Container instance method variant of ivy.lerp. This method simply wraps the function, and so the docstring for ivy.lerp also applies to this method with minimal changes.
- Parameters:
self (
Container
) – The container whose arrays should be used as parameter: inputend (
Union
[Array
,NativeArray
,Container
]) – The container whose arrays should be used as parameter: endweight (
Union
[Array
,NativeArray
,float
,Container
]) – The container whose arrays or scalar should be used as parameter: weightout (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – container including input + ((end - input) * weight)
Examples
With one
ivy.Container
input: >>> input = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([1, 5, 10])) >>> end = ivy.Container(a=ivy.array([10, 10, 10]), b=ivy.array([20, 20, 20])) >>> weight = ivy.Container(a=ivy.array(0.5), b=ivy.array([0.4, 0.5, 0.6])) >>> input.lerp(end, weight) {a: ivy.array([5.5, 6., 6.5]), b: ivy.array([8.60000038, 12.5, 16.])
}
- modf(*, out=None)[source]#
ivy.Container instance method variant of ivy.modf. This method simply wraps the function, and so the docstring for ivy.modf also applies to this method with minimal changes.
- Parameters:
self (
Container
) – The container whose arrays should be split into the fractional and integral parts.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – container including the fractional and integral parts of x.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=ivy.array([1.2, 2.7, 3.9]), >>> b = ivy.array([-1.5, 5.3, -10.7])) >>> x.modf() {a: (ivy.array([0.2, 0.7, 0.9]), ivy.array([1.0, 2.0, 3.0])), b: (ivy.array([-0.5, 0.3, -0.7]), ivy.array([-1.0, 5.0, -10.0]))
}
- nansum(*, axis=None, dtype=None, keepdims=False, out=None)[source]#
ivy.Container instance method variant of ivy.nansum. This method simply wraps the function, and so the docstring for ivy.nansum also applies to this method with minimal changes.
- Parameters:
self (
Container
) – Input container including arrays.axis (
Optional
[Union
[tuple
,int
,Container
]], default:None
) – Axis or axes along which the sum is computed. The default is to compute the sum of the flattened array.dtype (
Optional
[Union
[Dtype
,NativeDtype
,Container
]], default:None
) – The type of the returned array and of the accumulator in which the elements are summed. By default, the dtype of input is used.keepdims (
Union
[bool
,Container
], default:False
) – If this is set to True, the axes which are reduced are left in the result as dimensions with size one.out (
Optional
[Container
], default:None
) – Alternate output array in which to place the result. The default is None.
- Return type:
Container
- Returns:
ret – A new array holding the result is returned unless out is specified, in which it is returned.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=ivy.array([[10, 7, 4], [3, 2, 1]]), b=ivy.array([[1, 4, 2], [ivy.nan, ivy.nan, 0]])) >>> x.nansum(axis=0) {a: ivy.array([13, 9, 5]), b: ivy.array([1., 4., 2.])
} >>> x.nansum(axis=1) {
a: ivy.array([21, 6]), b: ivy.array([7., 0.])
}
- nextafter(x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.nextafter. This method simply wraps the function, and so the docstring for ivy.nextafter also applies to this method with minimal changes.
- Parameters:
self (
Container
) – Input container containing first input array.x2 (
Container
) – Input container containing second input array.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
) – Alternate output array in which to place the result. The default is None.
- Return type:
Container
- Returns:
ret – container including the next representable values of input container’s arrays, element-wise
Examples
>>> x1 = ivy.Container(a=ivy.array([1.0e-50, 2.0e+50]), ... b=ivy.array([2.0, 1.0]) >>> x2 = ivy.Container(a=ivy.array([5.5e-30]), ... b=ivy.array([-2.0])) >>> x1.nextafter(x2) { a: ivy.array([1.4013e-45., 3.4028e+38]), b: ivy.array([5.5e-30]) }
- signbit(*, out=None)[source]#
ivy.Container instance method variant of ivy.signbit. This method simply wraps the function, and so the docstring for ivy.signbit also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container with array-like items.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – Container including arrays with element-wise signbit of input arrays.
Examples
>>> x = ivy.Container(a=ivy.array([1, -2, 3]), b=-5) >>> x.signbit() { a: ivy.array([False, True, False]) b: ivy.array([True]) }
- sinc(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.sinc. This method simply wraps the function, and so the docstring for ivy.sinc also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container whose elements are each expressed in radians. Should have a floating-point data type.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
ret – a container containing the sinc of each element in
self
. The returned container must have a floating-point data type determined by type-promotion.
Examples
>>> x = ivy.Container(a=ivy.array([0.5, 1.5, 2.5]), ... b=ivy.array([3.5, 4.5, 5.5])) >>> y = x.sinc() >>> print(y) { a: ivy.array([0.637,-0.212,0.127]), b: ivy.array([-0.0909,0.0707,-0.0579]) }
- sparsify_tensor(card, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.sparsify_tensor.
This method simply wraps the function, and so the docstring for ivy.sparsify_tensor also applies to this method with minimal changes.
- Return type:
Container
- static static_allclose(x1, x2, /, *, rtol=1e-05, atol=1e-08, equal_nan=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.allclose. This method simply wraps the function, and so the docstring for ivy.allclose also applies to this method with minimal changes.
- Parameters:
x1 (
Union
[Container
,Array
,NativeArray
]) – Input container containing first input array.x2 (
Union
[Container
,Array
,NativeArray
]) – Input container containing second input array.rtol (
Union
[float
,Container
], default:1e-05
) – The relative tolerance parameter.atol (
Union
[float
,Container
], default:1e-08
) – The absolute tolerance parameter.equal_nan (
Union
[bool
,Container
], default:False
) – Whether to compare NaN’s as equal. If True, NaN’s in x1 will be considered equal to NaN’s in x2 in the output array.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
[Union
[Array
,Container
]], default:None
) – Alternate output array in which to place the result. The default is None.
- Return type:
Container
- Returns:
ret – A new container holding the result is returned unless out is specified, in which it is returned.
Examples
>>> x1 = ivy.Container(a=ivy.array([1., 2., 3.]), ... b=ivy.array([1., 2., 3.])) >>> x2 = ivy.Container(a=ivy.array([1., 2., 3.]), ... b=ivy.array([1., 2., 3.])) >>> y = ivy.Container.static_allclose(x1, x2) >>> print(y) { a: ivy.array(True), b: ivy.array(True) }
>>> x1 = ivy.Container(a=ivy.array([1., 2., 3.]), ... b=ivy.array([1., 2., 3.])) >>> x2 = ivy.Container(a=ivy.array([1., 2., 3.0003]), ... b=ivy.array([1.0006, 2., 3.])) >>> y = ivy.Container.static_allclose(x1, x2, rtol=1e-3) >>> print(y) { a: ivy.array(True), b: ivy.array(True) }
- static static_amax(x, /, *, axis=None, keepdims=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.amax. This method simply wraps the function, and so the docstring for ivy.amax also applies to this method with minimal changes.
- Parameters:
x (
Container
) – input container. Should have a real-valued data type.axis (
Optional
[Union
[int
,Sequence
[int
],Container
]], default:None
) – axis or axes along which maximum values must be computed. By default, the maximum value must be computed over the entire array. If a tuple of integers, maximum values must be computed over multiple axes. Default:None
.keepdims (
Union
[bool
,Container
], default:False
) – optional boolean, ifTrue
, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see `broadcasting<https://data-apis.org/array-api/ latest/API_specification/ broadcasting.html#broadcasting>`_). Otherwise, ifFalse
, the reduced axes (dimensions) must not be included in the result. Default:False
.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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, for writing the result to. It must have a shape that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – container, if the maximum value was computed over the entire array, a zero-dimensional array containing the maximum value; otherwise, a non-zero-dimensional array containing the maximum values. The returned array must have the same data type as
x
.
Examples
With
ivy.Container
input:>>> x = ivy.Container(a=ivy.array([1, 2, 3]), ... b=ivy.array([2, 3, 4])) >>> y = ivy.Container.static_amax(x) >>> print(y) { a: ivy.array(3), b: ivy.array(4) }
>>> x = ivy.Container(a=ivy.array([[1, 2, 3], [-1, 0, 2]]), ... b=ivy.array([[2, 3, 4], [0, 1, 2]])) >>> y = ivy.Container.static_amax(x, axis=1) >>> print(y) { a:ivy.array([3, 2]), b:ivy.array([4, 2]) }
- static static_amin(x, /, *, axis=None, keepdims=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.amin. This method simply wraps the function, and so the docstring for ivy.amin also applies to this method with minimal changes.
- Parameters:
x (
Container
) – input container. Should have a real-valued data type.axis (
Optional
[Union
[int
,Sequence
[int
],Container
]], default:None
) – axis or axes along which minimum values must be computed. By default, the minimum value must be computed over the entire array. If a tuple of integers, minimum values must be computed over multiple axes. Default:None
.keepdims (
Union
[bool
,Container
], default:False
) – optional boolean, ifTrue
, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see `broadcasting<https://data-apis.org/array-api/latest/ API_specification/broadcasting.html#broadcasting>`_). Otherwise, ifFalse
, the reduced axes (dimensions) must not be included in the result. Default:False
.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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, for writing the result to. It must have a shape that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – container, if the minimum value was computed over the entire array, a zero-dimensional array containing the minimum value; otherwise, a non-zero-dimensional array containing the minimum values. The returned array must have the same data type as
x
.
Examples
With
ivy.Container
input:>>> x = ivy.Container(a=ivy.array([1, 2, 3]), ... b=ivy.array([2, 3, 4])) >>> y = ivy.Container.static_amin(x) >>> print(y) { a: ivy.array(1), b: ivy.array(2) }
>>> x = ivy.Container(a=ivy.array([[1, 2, 3], [-1, 0, 2]]), ... b=ivy.array([[2, 3, 4], [0, 1, 2]])) >>> y = ivy.Container.static_amin(x, axis=1) >>> print(y) { a:ivy.array([1, -1]), b:ivy.array([2, 0]) }
- static static_binarizer(x, /, *, threshold=0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
Map the values of the input tensor to either 0 or 1, element-wise, based on the outcome of a comparison against a threshold value.
- Parameters:
self – input container. Should have a real-valued floating-point data type.
threshold (
Union
[float
,Container
], default:0
) – Values greater than this are mapped to 1, others to 0.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
ret – Binarized output data
- static static_conj(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.conj. This method simply wraps the function, and so the docstring for ivy.conj also applies to this method with minimal changes.
- Parameters:
x (
Union
[Container
,Array
,NativeArray
]) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
ret – a container containing output array(s) of the same dtype as the input array(s) with the complex conjugates of the complex values present in the input array. If x is a container of scalar(s) then a container of scalar(s) will be returned.
Examples
>>> x = ivy.Container(a=ivy.array([-1+5j, 0-0j, 1.23j]), ... b=ivy.array([7.9, 0.31+3.3j, -4.2-5.9j])) >>> z = ivy.Container.static_conj(x) >>> print(z) { a: ivy.array([-1-5j, 0+0j, -1.23j]), b: ivy.array([7.9, 0.31-3.3j, -4.2+5.9j]) }
- static static_copysign(x1, x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.copysign. This method simply wraps the function, and so the docstring for ivy.copysign also applies to this method with minimal changes.
- Parameters:
x1 (
Union
[Array
,NativeArray
,Container
,Number
]) – Container, Array, or scalar to change the sign ofx2 (
Union
[Array
,NativeArray
,Container
,Number
]) – Container, Array, or scalar from which the new signs are applied Unsigned zeroes are considered positive.out (
Optional
[Container
], default:None
) – optional output Container, for writing the result to.
- Return type:
Container
- Returns:
ret – x1 with the signs of x2. This is a scalar if both x1 and x2 are scalars.
Examples
>>> x1 = ivy.Container(a=ivy.array([0,1,2]), b=ivy.array(-1)) >>> x2 = ivy.Container(a=-1, b=ivy.array(10)) >>> ivy.Container.static_copysign(x1, x2) { a: ivy.array([-0., -1., -2.]), b: ivy.array(1.) } >>> ivy.Container.static_copysign(23, x1) { a: ivy.array([23., 23., 23.]), b: ivy.array(-23.) }
- static static_count_nonzero(a, /, *, axis=None, keepdims=False, dtype=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.count_nonzero. This method simply wraps the function, and so the docstring for ivy.count_nonzero also applies to this method with minimal changes.
- Parameters:
a (
Union
[Array
,NativeArray
,Container
]) – container with the base input arrays.axis (
Optional
[Union
[int
,Tuple
[int
,...
],Container
]], default:None
) – optional axis or tuple of axes along which to count non-zeros. Default is None, meaning that non-zeros will be counted along a flattened version of the input array.keepdims (
Union
[bool
,Container
], default:False
) – optional, if this is set to True, the axes that are counted are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.dtype (
Optional
[Union
[Dtype
,NativeDtype
,Container
]], default:None
) – optional output dtype. Default is of type integer.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.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – Container including number of non-zero values in the array along a given axis. Otherwise, container with the total number of non-zero values in the array is returned.
Examples
>>> x = ivy.Container(a=ivy.array([[0, 1, 2, 3],[4, 5, 6, 7]]), b=ivy.array([[[0,1],[2,3]],[[4,5],[6,7]]])) >>> ivy.Container.static_count_nonzero(x) { a: ivy.array(7), b: ivy.array(7) } >>> x = ivy.Container(a=ivy.array([[0, 1, 2, 3],[4, 5, 6, 7]]), b=ivy.array([[[0,1],[2,3]],[[4,5],[6,7]]])) >>> ivy.Container.static_count_nonzero(x, axis=0) { a: ivy.array([1, 2, 2, 2]), b: ivy.array([[1, 2], [2, 2]]) } >>> x = ivy.Container(a=ivy.array([[0, 1, 2, 3],[4, 5, 6, 7]]), b=ivy.array([[[0,1],[2,3]],[[4,5],[6,7]]])) >>> ivy.Container.static_count_nonzero(x, axis=(0,1), keepdims=True) { a: ivy.array([[7]]), b: ivy.array([[[3, 4]]]) }
- static static_diff(x, /, *, n=1, axis=-1, prepend=None, append=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.diff. This method simply wraps the function, and so the docstring for ivy.diff also applies to this method with minimal changes.
- Parameters:
x (
Union
[Container
,Array
,NativeArray
]) – input container with array-like items.n (
Union
[int
,Container
], default:1
) – The number of times values are differenced. If zero, the input is returned as-is.axis (
Union
[int
,Container
], default:-1
) – The axis along which the difference is taken, default is the last axis.prepend (
Optional
[Union
[Array
,NativeArray
,int
,list
,tuple
,Container
]], default:None
) – Values to prepend/append to x along given axis prior to performing the difference. Scalar values are expanded to arrays with length 1 in the direction of axis and the shape of the input array in along all other axes. Otherwise the dimension and shape must match x except along axis.append (
Optional
[Union
[Array
,NativeArray
,int
,list
,tuple
,Container
]], default:None
) – Values to prepend/append to x along given axis prior to performing the difference. Scalar values are expanded to arrays with length 1 in the direction of axis and the shape of the input array in along all other axes. Otherwise the dimension and shape must match x except along axis.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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.
- Return type:
Container
- Returns:
ret – Container including arrays with the n-th discrete difference along the given axis.
Examples
>>> x = ivy.Container(a=ivy.array([1, 2, 4, 7, 0]), b=ivy.array([1, 2, 4, 7, 0])) >>> ivy.Container.static_diff(x) { a: ivy.array([ 1, 2, 3, -7]), b: ivy.array([ 1, 2, 3, -7]) }
- static static_digamma(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.digamma. This method simply wraps the function, and so the docstring for ivy.digamma also applies to this method with minimal changes.
Note
The Ivy version only accepts real-valued inputs.
- Parameters:
x (
Union
[Container
,Array
,NativeArray
]) – Input container containing input arrays.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]], default:None
) – The key-chains to apply or not apply the method to. Default isNone
.to_apply (
bool
, default:True
) – If True, the method will be applied to key_chains, otherwise key_chains will be skipped. Default isTrue
.prune_unapplied (
bool
, default:False
) – Whether to prune key_chains for which the function was not applied. Default isFalse
.map_sequences (
bool
, default:False
) – Whether to also map method to sequences (lists, tuples). Default isFalse
.out (
Optional
[Array
], default:None
) – Alternate output array in which to place the result. The default is None.
- Return type:
Container
- Returns:
ret – container including the digamma function computed element-wise
Examples
>>> x = ivy.Container(a=ivy.array([1, 0.5]), ... b=ivy.array([-2.0, 3.0])) >>> ivy.Container.static_digamma(x) { a: ivy.array([-0.57721537, -1.96351004]), b: ivy.array([nan, 0.92278427]) }
- static static_erfc(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.erfc. This method simply wraps the function, and so the docstring for ivy.erfc also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – The container whose array contains real or complex valued argument.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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.
- Return type:
Container
- Returns:
ret – container with values of the complementary error function.
Examples
>>> x = ivy.Container(a=ivy.array([1., 2.]), b=ivy.array([-3., -4.])) >>> ivy.Container.static_erfc(x) { a: ivy.array([0.15729921, 0.00467773]), b: ivy.array([1.99997795, 2.]) }
- static static_erfinv(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.erfinv. This method simply wraps the function, and so the docstring for ivy.erfinv also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – The container whose array contains real or complex valued argument.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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.
- Return type:
Container
- Returns:
ret – container with values of the inverse error function.
Examples
>>> x = ivy.Container(a=ivy.array([1., 2.]), b=ivy.array([-3., -4.])) >>> ivy.Container.static_erfinv(x) { a: ivy.array([0.15729921, 0.00467773]), b: ivy.array([1.99997795, 2.]) }
- static static_fix(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.fix. This method simply wraps the function, and so the docstring for ivy.fix also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input container with array items.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – Container including arrays with element-wise rounding of input arrays elements.
Examples
>>> x = ivy.Container(a=ivy.array([2.1, 2.9, -2.1]), b=ivy.array([3.14])) >>> ivy.Container.static_fix(x) { a: ivy.array([ 2., 2., -2.]) b: ivy.array([ 3.0 ]) }
- static static_float_power(x1, x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.float_power. This method simply wraps the function, and so the docstring for ivy.float_power also applies to this method with minimal changes.
- Parameters:
x1 (
Union
[Array
,NativeArray
,Container
,float
,list
,tuple
]) – container with the base input arrays.x2 (
Union
[Array
,NativeArray
,Container
,float
,list
,tuple
]) – container with the exponent input arraysout (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – Container including arrays with base arrays raised to the powers of exponents arrays, element-wise .
Examples
>>> x1 = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([2, 10])) >>> x2 = ivy.Container(a=ivy.array([1, 3, 1]), b=0) >>> ivy.Container.static_float_power(x1, x2) { a: ivy.array([1, 8, 3]) b: ivy.array([1, 1]) }
- static static_fmax(x1, x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.fmax. This method simply wraps the function, and so the docstring for ivy.fmax also applies to this method with minimal changes.
- Parameters:
x1 (
Union
[Array
,NativeArray
,Container
]) – container with the first input arrays.x2 (
Union
[Array
,NativeArray
,Container
]) – container with the second input arraysout (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – Container including arrays with element-wise maximums.
Examples
>>> x1 = ivy.Container(a=ivy.array([2, 3, 4]), b=ivy.array([ivy.nan, 0, ivy.nan])) >>> x2 = ivy.Container(a=ivy.array([1, 5, 2]), b=ivy.array([0, ivy.nan, ivy.nan])) >>> ivy.Container.static_fmax(x1, x2) { a: ivy.array([ 2., 5., 4.]) b: ivy.array([ 0, 0, nan]) }
- static static_fmod(x1, x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.fmod. This method simply wraps the function, and so the docstring for ivy.fmod also applies to this method with minimal changes.
- Parameters:
x1 (
Union
[Array
,NativeArray
,Container
]) – container with the first input arrays.x2 (
Union
[Array
,NativeArray
,Container
]) – container with the second input arraysout (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – Container including arrays with element-wise remainder of divisions.
Examples
>>> x1 = ivy.Container(a=ivy.array([2, 3, 4]), b=ivy.array([ivy.nan, 0, ivy.nan])) >>> x2 = ivy.Container(a=ivy.array([1, 5, 2]), b=ivy.array([0, ivy.nan, ivy.nan])) >>> ivy.Container.static_fmod(x1, x2) { a: ivy.array([ 0, 3, 0]) b: ivy.array([ nan, nan, nan]) }
- static static_frexp(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.frexp. This method simply wraps the function, and so the docstring for ivy.frexp also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – The container whose arrays should be split into mantissa and exponent.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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.
- Return type:
Container
- Returns:
ret – container including the mantissa and exponent of x.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([1, 5, 10])) >>> ivy.Container.static_frexp(x) {a: (ivy.array([0.5, 0.5, 0.75]), ivy.array([1, 1, 2])), b: (ivy.array([0.5, 0.625, 0.625]), ivy.array([1, 3, 4]))
}
- static static_gradient(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, spacing=1, edge_order=1, axis=None)[source]#
- Return type:
Container
- static static_hypot(x1, x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.hypot. This method simply wraps the function, and so the docstring for ivy.hypot also applies to this method with minimal changes.
- Parameters:
x1 (
Union
[Container
,Array
,NativeArray
]) – Input container containing first input array.x2 (
Union
[Container
,Array
,NativeArray
]) – Input container containing second input array.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
[Union
[Array
,Container
]], default:None
) – Alternate output array in which to place the result. The default is None.
- Return type:
Container
- Returns:
ret – container including the hypot function computed element-wise
Examples
>>> x = ivy.Container(a=ivy.array([2.0]), ... b=ivy.array([3.0])) >>> y = ivy.Container(a=ivy.array([3.0]), b=ivy.array([4.0])) >>> ivy.Container.static_hypot(x, y) { a: ivy.array([3.6055]), b: ivy.array([5.]) }
- static static_isclose(a, b, /, *, rtol=1e-05, atol=1e-08, equal_nan=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.isclose. This method simply wraps the function, and so the docstring for ivy.isclose also applies to this method with minimal changes.
- Parameters:
a (
Union
[Container
,Array
,NativeArray
]) – Input container containing first input array.b (
Union
[Container
,Array
,NativeArray
]) – Input container containing second input array.rtol (
Union
[float
,Container
], default:1e-05
) – The relative tolerance parameter.atol (
Union
[float
,Container
], default:1e-08
) – The absolute tolerance parameter.equal_nan (
Union
[bool
,Container
], default:False
) – Whether to compare NaN’s as equal. If True, NaN’s in a will be considered equal to NaN’s in b in the output array.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
[Union
[Array
,Container
]], default:None
) – Alternate output array in which to place the result. The default is None.
- Return type:
Container
- Returns:
ret – A new array holding the result is returned unless out is specified, in which it is returned.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=ivy.array([1.0, ivy.nan]), b=ivy.array([1.0, ivy.nan])) >>> y = ivy.Container(a=ivy.array([1.0, ivy.nan]), b=ivy.array([1.0, ivy.nan])) >>> ivy.Container.static_isclose(x, y) {a: ivy.array([True, False]), b: ivy.array([True, False])
} >>> ivy.Container.static_isclose(x, y, equal_nan=True) {
a: ivy.array([True, True]), b: ivy.array([True, True])
} >>> x = ivy.Container(a=ivy.array([1.0, 2.0]), b=ivy.array([1.0, 2.0])) >>> y = ivy.Container(a=ivy.array([1.0, 2.001]), b=ivy.array([1.0, 2.0])) >>> ivy.Container.static_isclose(x, y, atol=0.0) {
a: ivy.array([True, False]), b: ivy.array([True, True])
} >>> ivy.Container.static_isclose(x, y, rtol=0.01, atol=0.0) {
a: ivy.array([True, True]), b: ivy.array([True, True])
}
- static static_ldexp(x1, x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.ldexp. This method simply wraps the function, and so the docstring for ivy.ldexp also applies to this method with minimal changes.
- Parameters:
x1 (
Union
[Array
,NativeArray
,Container
]) – The container whose arrays should be multiplied by 2**i.x2 (
Union
[Array
,NativeArray
,Container
]) – The container whose arrays should be used to multiply x by 2**i.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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.
- Return type:
Container
- Returns:
ret – container including x1 * 2**x2.
Examples
With one
ivy.Container
input: >>> x1 = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([1, 5, 10])) >>> x2 = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([1, 5, 10])) >>> ivy.Container.static_ldexp(x1, x2) {a: ivy.array([2, 8, 24]), b: ivy.array([2, 160, 10240])
}
- static static_lerp(input, end, weight, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.lerp. This method simply wraps the function, and so the docstring for ivy.lerp also applies to this method with minimal changes.
- Parameters:
input (
Union
[Array
,NativeArray
,Container
]) – The container whose arrays should be used as parameter: inputend (
Union
[Array
,NativeArray
,Container
]) – The container whose arrays should be used as parameter: endweight (
Union
[Array
,NativeArray
,float
,Container
]) – The container whose arrays or scalar should be used as parameter: weightkey_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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.
- Return type:
Container
- Returns:
ret – container including input + ((end - input) * weight)
Examples
With one
ivy.Container
input: >>> input = ivy.Container(a=ivy.array([0., 1., 2.]), b=ivy.array([3., 4., 5.])) >>> end = ivy.array([10.]) >>> weight = 1.1 >>> y = ivy.Container.static_lerp(input, end, weight) >>> print(y) {a: ivy.array([11., 10.90000057, 10.80000019]), b: ivy.array([10.70000076, 10.60000038, 10.5])
} >>> input = ivy.Container(a=ivy.array([10.1, 11.1]), b=ivy.array([10, 11])) >>> end = ivy.Container(a=ivy.array([5])) >>> weight = ivy.Container(a=0.5) >>> y = ivy.Container.static_lerp(input, end, weight) >>> print(y) {
a: ivy.array([7.55000019, 8.05000019]), b: {
a: ivy.array([7.5, 8.])
}
}
- static static_modf(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.modf. This method simply wraps the function, and so the docstring for ivy.modf also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – The container whose arrays should be split into the fractional and integral parts.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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.
- Return type:
Container
- Returns:
ret – container including the fractional and integral parts of x.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=ivy.array([1.2, 2.7, 3.9]), >>> b = ivy.array([-1.5, 5.3, -10.7])) >>> ivy.Container.static_modf(x) {a: (ivy.array([0.2, 0.7, 0.9]), ivy.array([1.0, 2.0, 3.0])), b: (ivy.array([-0.5, 0.3, -0.7]), ivy.array([-1.0, 5.0, -10.0]))
}
- static static_nansum(x, /, *, axis=None, dtype=None, keepdims=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.nansum. This method simply wraps the function, and so the docstring for ivy.nansum also applies to this method with minimal changes.
- Parameters:
x (
Union
[Container
,Array
,NativeArray
]) – Input array.axis (
Optional
[Union
[tuple
,int
,Container
]], default:None
) – Axis or axes along which the sum is computed. The default is to compute the sum of the flattened array.dtype (
Optional
[Union
[Dtype
,NativeDtype
,Container
]], default:None
) – The type of the returned array and of the accumulator in which the elements are summed. By default, the dtype of input is used.keepdims (
Union
[bool
,Container
], default:False
) – If this is set to True, the axes which are reduced are left in the result as dimensions with size one.out (
Optional
[Union
[Array
,Container
]], default:None
) – Alternate output array in which to place the result. The default is None.
- Return type:
Container
- Returns:
ret – A new array holding the result is returned unless out is specified, in which it is returned.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=ivy.array([[10, 7, 4], [3, 2, 1]]), b=ivy.array([[1, 4, 2], [ivy.nan, ivy.nan, 0]])) >>> ivy.Container.static_nansum(x) {a: 27, b: 7.0
} >>> ivy.Container.static_nansum(x, axis=0) {
a: ivy.array([13, 9, 5]), b: ivy.array([1., 4., 2.])
} >>> ivy.Container.static_nansum(x, axis=1) {
a: ivy.array([21, 6]), b: ivy.array([7., 0.])
}
- static static_nextafter(x1, x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.nextafter. This method simply wraps the function, and so the docstring for ivy.nextafter also applies to this method with minimal changes.
- Parameters:
x1 (
Union
[Container
,Array
,NativeArray
]) – Input container containing first input arrays.x2 (
Union
[Container
,Array
,NativeArray
]) – Input container containing second input arrays.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
[Union
[Array
,Container
]], default:None
) – Alternate output array in which to place the result. The default is None.
- Return type:
Container
- Returns:
ret – container including the next representable values of input container’s arrays, element-wise
Examples
>>> x1 = ivy.Container(a=ivy.array([1.0e-50, 2.0e+50]), ... b=ivy.array([2.0, 1.0]) >>> x2 = ivy.Container(a=ivy.array([5.5e-30]), ... b=ivy.array([-2.0])) >>> ivy.Container.static_nextafter(x1, x2) { a: ivy.array([1.4013e-45., 3.4028e+38]), b: ivy.array([5.5e-30]) }
- static static_signbit(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.signbit. This method simply wraps the function, and so the docstring for ivy.signbit also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
,float
,int
,list
,tuple
]) – input container with array-like items.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – Container including arrays with element-wise signbit of input arrays.
Examples
>>> x = ivy.Container(a=ivy.array([1, -2, 3]), b=-5) >>> ivy.Container.static_signbit(x) { a: ivy.array([False, True, False]) b: ivy.array([True]) }
- static static_sinc(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.sinc. This method simply wraps the function, and so the docstring for ivy.sinc also applies to this method with minimal changes.
- Parameters:
x (
Container
) – input container whose elements are each expressed in radians. Should have a floating-point data type.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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:
ret – a container containing the sinc of each element in
x
. The returned container must have a floating-point data type determined by type-promotion.
Examples
>>> x = ivy.Container(a=ivy.array([0.5, 1.5, 2.5]), ... b=ivy.array([3.5, 4.5, 5.5])) >>> y = ivy.Container.static_sinc(x) >>> print(y) { a: ivy.array([0.636, -0.212, 0.127]), b: ivy.array([-0.090, 0.070, -0.057]) }
- static static_sparsify_tensor(x, card, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.sparsify_tensor. This method simply wraps the function, and so the docstring for ivy.sparsify_tensor also applies to this method with minimal changes.
- Parameters:
x (
Union
[Container
,Array
,NativeArray
]) – Input container containing input arrays.card (
Union
[int
,Container
]) – The number of values to keep in each tensor.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]], default:None
) – The key-chains 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
) – Alternate output container in which to place the result. The default is None.
- Return type:
Container
- Returns:
ret – container including the sparsified tensor computed element-wise
Examples
>>> x = ivy.Container( a=ivy.reshape(ivy.arange(100), (10, 10)), b=ivy.reshape(ivy.arange(100), (10, 10)), ) >>> ivy.Container.static_sparsify_tensor(x, 10) { a: (<class ivy.data_classes.array.array.Array> shape=[10, 10]), b: (<class ivy.data_classes.array.array.Array> shape=[10, 10]) }
- static static_xlogy(x, y, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.xlogy. This method simply wraps the function, and so the docstring for ivy.xlogy also applies to this method with minimal changes.
- Parameters:
x (
Union
[Container
,Array
,NativeArray
]) – Input container containing first input arrays.y (
Union
[Container
,Array
,NativeArray
]) – Input container containing second input arrays.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
[Union
[Array
,Container
]], default:None
) – Alternate output array in which to place the result. The default is None.
- Return type:
Container
- Returns:
ret – container including the next representable values of input container’s arrays, element-wise
Examples
>>> x = ivy.Container(a=ivy.zeros(3)), ... b=ivy.array([1.0, 2.0, 3.0])) >>> y = ivy.Container(a=ivy.array([-1.0, 0.0, 1.0]), ... b=ivy.array([3.0, 2.0, 1.0])) >>> ivy.Container.static_xlogy(x, y) { a: ivy.array([0.0, 0.0, 0.0]), b: ivy.array([1.0986, 1.3863, 0.0000]) }
- static static_zeta(x, q, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.zeta. This method simply wraps the function, and so the docstring for ivy.zeta also applies to this method with minimal changes.
- Parameters:
x (
Union
[Container
,Array
,NativeArray
]) – Input container containing first input arrays.q (
Union
[Container
,Array
,NativeArray
]) – Input container containing second input arrays.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains 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
[Union
[Array
,Container
]], default:None
) – Alternate output array in which to place the result. The default is None.
- Return type:
Container
- Returns:
ret – container including the zeta function computed element-wise
Examples
>>> x = ivy.Container(a=ivy.array([5.0, 3.0]), ... b=ivy.array([2.0, 1.0]) >>> q = ivy.