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 is None.
to_apply (Union[bool, Container], default: True) – If True, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is True.
prune_unapplied (Union[bool, Container], default: False) – Whether to prune key_chains for which the function was not applied.
Default is False.
map_sequences (Union[bool, Container], default: False) – Whether to also map method to sequences (lists, tuples).
Default is False.
complex_mode (Literal['split', 'magnitude', 'jax'], default: 'jax') – optional specifier for how to handle complex data types. See
ivy.func_wrapper.handle_complex_input for more detail.
out (Optional[Container], default: None) – optional output container, for writing the result to. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – a container with the celu unit function applied element-wise.
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.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 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. 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.
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.
ivy.Container static method which acts as a wrapper for
ivy.hardsilu.
Parameters:
x (Union[Array, NativeArray, Container]) – 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 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. 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
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 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. 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.
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.7159
beta (Union[float, Container], default: 0.67) – The scaling parameter for the input.
Determines the slope of the tanh function.
Default: 0.67
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. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – a container with the scaled_tanh function applied.
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 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. 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.
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.
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 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. 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.
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.
ivy.Container instance method variant of ivy.leaky_relu. This method
simply wraps the function, and so the docstring for ivy.leaky_relu also
applies to this method with minimal changes.
Parameters:
self (Container) – input container.
alpha (Container, default: 1.0) – array or scalar specifying alpha (negative slope) value for CELU
formulation.
key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The key-chains to apply or not apply the method to. Default is None.
to_apply (Union[bool, Container], default: True) – If True, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is True.
prune_unapplied (Union[bool, Container], default: False) – Whether to prune key_chains for which the function was not applied.
Default is False.
map_sequences (Union[bool, Container], default: False) – Whether to also map method to sequences (lists, tuples).
Default is False.
complex_mode (Literal['split', 'magnitude', 'jax'], default: 'jax') – optional specifier for how to handle complex data types. See
ivy.func_wrapper.handle_complex_input for more detail.
out (Optional[Container], default: None) – optional output container, for writing the result to. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – a container with the celu unit function applied element-wise.
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.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 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. 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.
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 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. 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
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 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. 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.
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.
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. See
ivy.func_wrapper.handle_complex_input for more detail.
out (Optional[Container], default: None) – Optional output Container.
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. See
ivy.func_wrapper.handle_complex_input for more detail.
Return type:
Container
Returns:
ret – Container with Log-sigmoid applied to the leaves.
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 is None.
to_apply (Union[bool, Container], default: True) – If True, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is True.
prune_unapplied (Union[bool, Container], default: False) – Whether to prune key_chains for which the function was not applied.
Default is False.
map_sequences (Union[bool, Container], default: False) – Whether to also map method to sequences (lists, tuples).
Default is False.
complex_mode (Literal['split', 'magnitude', 'jax'], default: 'jax') – optional specifier for how to handle complex data types. See
ivy.func_wrapper.handle_complex_input for more detail.
out (Optional[Container], default: None) – optional output container, for writing the result to. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – a container with the rectified linear 6 activation unit function
applied element-wise.
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.7159
beta (Union[float, Container], default: 0.67) – The scaling parameter for the input.
Determines the slope of the tanh function.
Default: 0.67
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. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – a container with the scaled_tanh function applied.
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 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. 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.
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 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. 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.
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. See
ivy.func_wrapper.handle_complex_input for more detail.
out (Optional[Container], default: None) – Optional output Container.
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.
key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The key-chains to apply or not apply the method to. Default is None.
to_apply (Union[bool, Container], default: True) – If True, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is True.
prune_unapplied (Union[bool, Container], default: False) – Whether to prune key_chains for which the function was not applied.
Default is False.
map_sequences (Union[bool, Container], default: False) – Whether to also map method to sequences (lists, tuples).
Default is False.
complex_mode (Literal['split', 'magnitude', 'jax'], default: 'jax') – optional specifier for how to handle complex data types. See
ivy.func_wrapper.handle_complex_input for more detail.
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 is None.
to_apply (Union[bool, Container], default: True) – If True, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is True.
prune_unapplied (Union[bool, Container], default: False) – Whether to prune key_chains for which the function was not applied.
Default is False.
map_sequences (Union[bool, Container], default: False) – Whether to also map method to sequences (lists, tuples).
Default is False.
complex_mode (Literal['split', 'magnitude', 'jax'], default: 'jax') – optional specifier for how to handle complex data types. See
ivy.func_wrapper.handle_complex_input for more detail.
out (Optional[Container], default: None) – optional output container, for writing the result to. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – a container with the rectified linear 6 activation unit function
applied element-wise.
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 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. 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.
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 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. 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.
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 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. 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.
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.
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 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. 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.
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)
{
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 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.
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – output array data type. If dtype is None, the output container
data type must be inferred from self. Default: None.
device (Optional[Union[Device, NativeDevice, Container]], default: None) – device on which to place the created array. If device is None, the
output container device must be inferred from self. 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 with ones
in diagonal k and zeros elsewhere.
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 equation
beta (Union[float, Container], default: 0.46) – The coefficient beta in the hamming window equation
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 Hamming windows.
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.
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.
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.
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]
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 container
coeffs (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.
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)
{
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 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.
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – output array data type. If dtype is None, the output container
data type must be inferred from self. Default None.
device (Optional[Union[Device, NativeDevice, Container]], default: None) – device on which to place the created array. If device is None, the
output container device must be inferred from self. 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 with ones
in diagonal k and zeros elsewhere.
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 equation
beta (Union[float, Container], default: 0.46) – The coefficient beta in the hamming window equation
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 Hamming windows.
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.
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.
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.
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 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.
Return type:
Container
Returns:
ret – MelWeightMatrix of shape: [frames, num_mel_bins]
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 is None.
to_apply (bool, default: True) – If True, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is True.
prune_unapplied (bool, default: False) – Whether to prune key_chains for which the function was not applied.
Default is False.
map_sequences (bool, default: False) – Whether to also map method to sequences (lists, tuples).
Default is False.
Return type:
Container
Returns:
ret – Output container containing simplified result of substituting x in the
coefficients - final value of polynomial.
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.
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 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.
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.
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 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.
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.
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.
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.
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.
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.
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.
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 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) – 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.
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, if True, 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, if False, 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 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, 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.
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, if True, 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,
if False, 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 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, 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.
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 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. It must have a shape
that the inputs broadcast to.
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 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. 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.
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 of
x2 (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.
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 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.
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.
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.
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()
{
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()
{
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.
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 arrays
out (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 .
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 arrays
out (Optional[Container], default: None) – optional output container, for writing the result to.
Return type:
Container
Returns:
ret – Container including arrays with element-wise maximums.
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 arrays
out (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.
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()
{
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
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 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) – 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
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 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) – 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)
{
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.
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: input
end (Union[Array, NativeArray, Container]) – The container whose arrays should be used as parameter: end
weight (Union[Array, NativeArray, float, Container]) – The container whose arrays or scalar should be used as parameter: weight
out (Optional[Container], default: None) – optional output container, for writing the result to.
Return type:
Container
Returns:
ret – container including input + ((end - input) * weight)
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()
{
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)
{
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 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) – 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
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.
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 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. 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.
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.
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 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[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.
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, if True, 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, if False, 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 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, 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.
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, if True, 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,
if False, 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 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, 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.
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 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. It must have a shape
that the inputs broadcast to.
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 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. 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.
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 of
x2 (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.
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.
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 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 arrays with the n-th discrete difference along
the given axis.
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 is None.
to_apply (bool, default: True) – If True, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is True.
prune_unapplied (bool, default: False) – Whether to prune key_chains for which the function was not applied.
Default is False.
map_sequences (bool, default: False) – Whether to also map method to sequences (lists, tuples).
Default is False.
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
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 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 with values of the complementary error function.
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 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 with values of the inverse error function.
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.
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 arrays
out (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 .
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 arrays
out (Optional[Container], default: None) – optional output container, for writing the result to.
Return type:
Container
Returns:
ret – Container including arrays with element-wise maximums.
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 arrays
out (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.
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 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 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)
{
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.
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[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
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 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[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)
{
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 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.
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: input
end (Union[Array, NativeArray, Container]) – The container whose arrays should be used as parameter: end
weight (Union[Array, NativeArray, float, Container]) – The container whose arrays or scalar should be used as parameter: weight
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 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)
{
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 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 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)
{
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)
{
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.
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[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
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.
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 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. 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.
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 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) – 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
staticstatic_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 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[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
staticstatic_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.
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[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
ivy.Container instance 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:
self (Container) – Input container containing first input array.
y (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 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) – 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
ivy.Container instance 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:
self (Container) – Input container containing first input array.
q (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 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) – 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
ivy.Container static method variant of ivy.reduce. This method
simply wraps the function, and so the docstring for ivy.reduce also
applies to this method with minimal changes.
Parameters:
operand (Union[Container, Array, NativeArray]) – The array to act on.
init_value (Union[int, float, Container]) – The value with which to start the reduction.
computation (Union[Callable, Container]) – The reduction function.
axes (Union[int, Sequence[int], Container], default: 0) – The dimensions along which the reduction is performed.
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.
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.
ivy.Container instance method variant of ivy.reduce. This method
simply wraps the function, and so the docstring for ivy.reduce also
applies to this method with minimal changes.
Parameters:
self (Container) – The array to act on.
init_value (Union[int, float, Container]) – The value with which to start the reduction.
computation (Union[Callable, Container]) – The reduction function.
axes (Union[int, Sequence[int], Container], default: 0) – The dimensions along which the reduction is performed.
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.
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.
ivy.Container static method variant of ivy.fft. This method simply
wraps the function, and so the docstring for ivy.fft also applies to
this method with minimal changes.
Parameters:
x (Union[Container, Array, NativeArray]) – Container containing input volumes […,d_in,…],
where d_in indicates the dimension that needs FFT.
dim (Union[int, Container]) – The dimension along which to take the one dimensional FFT.
norm (Union[str, Container], default: 'backward') – Optional argument, “backward”, “ortho” or “forward”. Defaults to be
“backward”.
“backward” indicates no normalization.
“ortho” indicates normalization by 1/sqrt(n).
“forward” indicates normalization by 1/n.
n (Optional[Union[int, Tuple[int], Container]], default: None) – Optional argument indicating the sequence length, if given, the input
would be padded with zero or truncated to length n before performing FFT.
Should be a integer greater than 1.
out (Optional[Container], default: None) – Optional output array, for writing the result to. It must have a shape that
the inputs broadcast to.
ivy.Container static method variant of ivy.sliding_window. This
method simply wraps the function, and so the docstring for
ivy.sliding_window also applies to this method with minimal changes.
Parameters:
input (Union[Array, NativeArray, Container]) – An array representing the base area on which the window is going to
slide over.
window_size (Union[int, Tuple[int, int], Tuple[int, int, int], Container]) – Size of the sliding window for each dimension of the input.
stride (Union[int, Tuple[int, int], Container], default: 1) – The stride of the sliding window for each dimension of input
padding (Union[str, int, Sequence[Tuple[int, int]], Container], default: 'VALID') – Either the string ‘SAME’ (padding with zeros evenly), the string ‘VALID’
(no padding), or a sequence of n (low, high) integer pairs that give the
padding to apply before and after each spatial dimension.
dilation (Union[int, Tuple[int, int], Container], default: 1) – The stride between elements within a sliding window, must be > 0.
ivy.Container instance method variant of ivy.avg_pool1d. This
method simply wraps the function, and so the docstring for
ivy.avg_pool1d also applies to this method with minimal changes.
Parameters:
self (Container) – Container of input images [batch_size, w, d_in].
kernel (Union[int, Tuple[int], Container]) – Size of the kernel i.e., the sliding window for each
dimension of input. [w].
strides (Union[int, Tuple[int], Container]) – The stride of the sliding window for each dimension of input.
padding (Union[str, Container]) – SAME” or “VALID” indicating the algorithm, or list
indicating the per-dimension paddings.
data_format (Union[str, Container], default: 'NWC') – NWC” or “NCW”. Defaults to “NWC”.
count_include_pad (Union[bool, Container], default: False) – Whether to include padding in the averaging calculation.
ceil_mode (Union[bool, Container], default: False) – Whether to use ceil or floor for creating the output shape.
out (Optional[Container], default: None) – optional output array, for writing the result to.
ivy.Container instance method variant of ivy.avg_pool2d. This
method simply wraps the function, and so the docstring for
ivy.avg_pool2d also applies to this method with minimal changes.
Parameters:
x – Input image [batch_size,h,w,d_in].
kernel (Union[int, Tuple[int], Tuple[int, int], Container]) – The size of the window to take a max over.
strides (Union[int, Tuple[int], Tuple[int, int], Container]) – The stride of the sliding window for each dimension of input.
padding (Union[str, Container]) – “SAME” or “VALID” indicating the algorithm, or list indicating
the per-dimension paddings.
data_format (Union[str, Container], default: 'NHWC') – “NHWC” or “NCHW”. Defaults to “NHWC”.
count_include_pad (Union[bool, Container], default: False) – Whether to include padding in the averaging calculation.
ceil_mode (Union[bool, Container], default: False) – Whether to use ceil or floor for creating the output shape.
divisor_override (Optional[Union[int, Container]], default: None) – If specified, it will be used as divisor,
otherwise kernel_size will be used.
out (Optional[Container], default: None) – optional output array, for writing the result to. It must have a shape
that the inputs broadcast to.
ivy.Container static method variant of ivy.avg_pool3d. This method
simply wraps the function, and so the docstring for ivy.avg_pool3d also
applies to this method with minimal changes.
ivy.Container instance method variant of ivy.dct. This method simply
wraps the function, and so the docstring for ivy.dct also applies to
this method with minimal changes.
Parameters:
self (Container) – Container with the input signals.
type (Union[Literal[1, 2, 3, 4], Container], default: 2) – The type of the dct. Must be 1, 2, 3 or 4.
n (Optional[Union[int, Container]], default: None) – The length of the transform. If n is less than the input signal length,
then x is truncated, if n is larger then x is zero-padded.
norm (Optional[Union[Literal['ortho'], Container]], default: None) – The type of normalization to be applied. Must be either None or “ortho”.
out (Optional[Container], default: None) – optional output container, for writing the result to.
ivy.Container instance method variant of ivy.fft. This method simply
wraps the function, and so the docstring for ivy.fft also applies to
this method with minimal changes.
Parameters:
self (Container) – Container containing input volumes […,d_in,…],
where d_in indicates the dimension that needs FFT.
dim (Union[int, Container]) – The dimension along which to take the one dimensional FFT.
norm (Union[str, Container], default: 'backward') – Optional argument, “backward”, “ortho” or “forward”. Defaults to be
“backward”.
“backward” indicates no normalization.
“ortho” indicates normalization by 1/sqrt(n).
“forward” indicates normalization by 1/n.
n (Optional[Union[int, Tuple[int], Container]], default: None) – Optional argument indicating the sequence length, if given, the input would
be padded with zero or truncated to length n before performing FFT.
Should be a integer greater than 1.
out (Optional[Union[Array, Container]], default: None) – Optional output array, for writing the result to. It must have a shape that
the inputs broadcast to.
Return type:
Container
Returns:
ret – Container containing the transformed inputs.
ivy.Container instance method variant of ivy.idct. This method
simply wraps the function, and so the docstring for ivy.idct also
applies to this method with minimal changes.
Parameters:
self (Container) – Container with the input signals.
type (Union[Literal[1, 2, 3, 4], Container], default: 2) – The type of the idct. Must be 1, 2, 3 or 4.
n (Optional[Union[int, Container]], default: None) – The length of the transform. If n is less than the input signal length,
then x is truncated, if n is larger then x is zero-padded.
norm (Optional[Union[Literal['ortho'], Container]], default: None) – The type of normalization to be applied. Must be either None or “ortho”.
out (Optional[Container], default: None) – optional output container, for writing the result to.
ivy.Container instance method variant of ivy.ifft. This method
simply wraps the function, and so the docstring for ivy.ifft also
applies to this method with minimal changes.
Parameters:
self (Container) – Container containing input volumes […,d_in,…],
where d_in indicates the dimension that needs IFFT.
dim (Union[int, Container]) – The dimension along which to take the one dimensional IFFT.
norm (Union[str, Container], default: 'backward') – Optional argument, “backward”, “ortho” or “forward”. Defaults to be
“backward”.
“backward” indicates no normalization.
“ortho” indicates normalization by 1/sqrt(n).
“forward” indicates normalization by 1/n.
n (Optional[Union[int, Tuple[int], Container]], default: None) – Optional argument indicating the sequence length, if given, the input
would be padded with zero or truncated to length n before performing IFFT.
Should be a integer greater than 1.
out (Optional[Union[Array, Container]], default: None) – Optional output array, for writing the result to. It must have a shape that
the inputs broadcast to.
Returns:
ret – Container containing the transformed inputs.
This method simply wraps the function, and so the docstring for
ivy.ifftn also applies to this method with minimal changes.
Parameters:
x – Input array of complex numbers.
s (Optional[Union[int, Tuple[int, ...], Container]], default: None) – sequence of ints, optional
Shape (length of transformed axis) of the output (s[0] refers to axis 0,
s[1] to axis 1, etc.). If given shape is smaller than that of the input,
the input is cropped. If larger, input is padded with zeros. If s is not
given, shape of input along axes specified by axes is used.
axes (Optional[Union[int, Tuple[int, ...], Container]], default: None) – axes over which to compute the IFFT. If not given, last len(s) axes are
used, or all axes if s is also not specified. Repeated indices in axes
means inverse transform over that axis is performed multiple times.
norm (Union[str, Container], default: 'backward') – Optional argument, “backward”, “ortho” or “forward”.
Defaults to be “backward”.
“backward” indicates no normalization.
“ortho” indicates normalization by 1/sqrt(n).
“forward” indicates normalization by 1/n.
out (Optional[Union[Array, Container]], default: None) – Optional output array, for writing the result to. It must have a shape that
the inputs broadcast to.
mode (Union[Literal['linear', 'bilinear', 'trilinear', 'nearest', 'area', 'nearest_exact', 'tf_area', 'bicubic'], Container], default: 'linear') – Interpolation mode. Can be one of the following:
- linear
- bilinear
- trilinear
- nearest
- area
- tf_area
- bicubic
- mitchellcubic
- lanczos3
- lanczos5
- gaussian
scale_factor (Optional[Union[int, Sequence[int], Container]], default: None) – Multiplier for spatial size that defines the output
size (overwriting size).
align_corners (Optional[Union[bool, Container]], default: None) – If True, the corner pixels of the input and output tensors are aligned,
and thus preserving the values at the corner pixels. If False, the corner
pixels are not aligned, and the interpolation uses edge value padding for
out-of-boundary values.
only has an effect when mode is ‘linear’, ‘bilinear’,
‘bicubic’ or ‘trilinear’. Default: False
antialias (Union[bool, Container], default: False) – If True, antialiasing is applied when downsampling an image.
Supported modes: ‘bilinear’, ‘bicubic’.
out (Optional[Container], default: None) – Optional output array, for writing the result to. It must
have a shape that the inputs broadcast to.
ivy.Container instance method variant of ivy.max_pool1d. This
method simply wraps the function, and so the docstring for
ivy.max_pool1d also applies to this method with minimal changes.
Parameters:
self (Container) – Container of input images [batch_size, w, d_in].
kernel (Union[int, Tuple[int, ...], Container]) – Size of the kernel i.e., the sliding window for each
dimension of input. [w].
strides (Union[int, Tuple[int, ...], Container]) – The stride of the sliding window for each dimension of input.
padding (Union[str, int, Tuple[int], List[Tuple[int, int]], Container]) – SAME” or “VALID” indicating the algorithm, or list
indicating the per-dimension paddings.
data_format (Union[str, Container], default: 'NWC') – “NWC” or “NCW”. Defaults to “NWC”.
dilaton – The stride between elements within a sliding window, must be > 0.
ceil_mode (Union[bool, Container], default: False) – If True, ceil is used instead of floor to compute the output shape.
This ensures that every element is covered by a sliding window.
out (Optional[Container], default: None) – optional output array, for writing the result to.
ivy.Container instance method variant of ivy.max_pool2d. This
method simply wraps the function, and so the docstring for
ivy.max_pool2d also applies to this method with minimal changes.
Parameters:
x – Input image [batch_size,h,w,d_in].
kernel (Union[int, Tuple[int, ...], Container]) – The size of the window to take a max over.
strides (Union[int, Tuple[int, ...], Container]) – The stride of the sliding window for each dimension of input.
padding (Union[str, int, Tuple[int], List[Tuple[int, int]], Container]) – “SAME” or “VALID” indicating the algorithm, or list indicating
the per-dimension paddings.
data_format (Union[str, Container], default: 'NHWC') – “NHWC” or “NCHW”. Defaults to “NHWC”.
dilaton – The stride between elements within a sliding window, must be > 0.
ceil_mode (Union[bool, Container], default: False) – If True, ceil is used instead of floor to compute the output shape.
This ensures that every element is covered by a sliding window.
out (Optional[Container], default: None) – optional output array, for writing the result to. It must have a shape
that the inputs broadcast to.
ivy.Container static method variant of ivy.max_pool3d. This method
simply wraps the function, and so the docstring for ivy.max_pool3d also
applies to this method with minimal changes.
strides (Union[int, Tuple[int, ...], Container]) – The stride of the sliding window for each dimension of input.
padding (Union[str, int, Tuple[int], List[Tuple[int, int]], Container]) – SAME” or “VALID” indicating the algorithm, or list indicating
the per-dimension paddings.
data_format (Union[str, Container], default: 'NDHWC') – “NDHWC” or “NCDHW”. Defaults to “NDHWC”.
dilaton – The stride between elements within a sliding window, must be > 0.
ceil_mode (Union[bool, Container], default: False) – If True, ceil is used instead of floor to compute the output shape.
This ensures that every element is covered by a sliding window.
out (Optional[Container], default: None) – optional output array, for writing the result to. It must
have a shape that the inputs broadcast to.
ivy.Container instance method variant of ivy.rfft. This method
simply wraps the function, and so the docstring for ivy.rfft also
applies to this method with minimal changes.
Parameters:
self (Container) – input array. Must have a real-valued floating-point data type.
n (Optional[Union[int, Container]], default: None) – length of the transformed axis of the input. If
- n is greater than the length of the input array, the input array
is zero-padded to length n.
- n is less than the length of the input array, the input array is
trimmed to length n.
- n is not provided, the length of the transformed axis of the
output must equal the length of the input along the axis specified
by axis. Default is None.
axis (Union[int, Container], default: -1) – axis (dimension) over which to compute the Fourier transform.
If not set, the last axis (dimension) is used. Default is -1.
norm (Union[Literal['backward', 'ortho', 'forward'], Container], default: 'backward') – normalization mode. Should be one of the following modes:
- ‘backward’: no normalization.
- ‘ortho’: normalize by 1/sqrt(n) (i.e., make the FFT orthonormal).
- ‘forward’: normalize by 1/n.
Default is backward.
out (Optional[Union[Array, Container]], default: None) – Optional output array, for writing the result to. It must
have a shape that the inputs broadcast to.
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.
Returns:
ret – an array transformed along the axis (dimension) indicated by axis.
The returned array must have a complex-valued floating-point
data type determined by Type Promotion Rules.
Compute the n-dimensional discrete Fourier Transform for real input.
Parameters:
axes (int or tuple of ints, optional) – Axes over which to compute the FFT. If not given, the last n axes are
used.
s (sequence of ints, optional) – Shape (length of each transformed axis) of the output. Along each axis,
if the given shape is smaller than
that of the input, the input is cropped. If it is larger, the input
is padded with zeros.
ivy.Container instance method variant of ivy.sliding_window. This
method simply wraps the function, and so the docstring for
ivy.sliding_window also applies to this method with minimal changes.
Parameters:
input – An array representing the base area on which the window is going to
slide over.
window_size (Union[int, Tuple[int, int], Tuple[int, int, int], Container]) – Size of the sliding window for each dimension of the input.
stride (Union[int, Tuple[int, int], Container], default: 1) – The stride of the sliding window for each dimension of input
padding (Union[str, int, Sequence[Tuple[int, int]], Container], default: 'VALID') – Either the string ‘SAME’ (padding with zeros evenly), the string ‘VALID’
(no padding), or a sequence of n (low, high) integer pairs that give the
padding to apply before and after each spatial dimension.
dilation (Union[int, Tuple[int, int], Container], default: 1) – The stride between elements within a sliding window, must be > 0.
ivy.Container static method variant of ivy.adaptive_avg_pool1d. This
method simply wraps the function, and so the docstring for
ivy.adaptive_avg_pool1d also applies to this method with minimal
changes.
Parameters:
input (Union[Array, NativeArray, Container]) – Input array. Must have shape (N, C, L_in) or (C, L_in) where N is
the batch dimension, C is the feature dimension, and L_in is the spatial
dimension.
ivy.Container static method variant of ivy.adaptive_avg_pool2d. This
method simply wraps the function, and so the docstring for
ivy.adaptive_avg_pool2d also applies to this method with minimal
changes.
Parameters:
input (Union[Array, NativeArray, Container]) – A 3D or 4D input array. Should have a floating-point data type.
ivy.Container static method variant of ivy.adaptive_max_pool2d. This
method simply wraps the function, and so the docstring for
ivy.adaptive_max_pool2d also applies to this method with minimal
changes.
Parameters:
input (Union[Array, NativeArray, Container]) – Input array. Must have shape (N, C, H_in, W_in) or (C, H_in, W_in) where N
is the batch dimension, C is the feature dimension, and H_in and W_in are
the 2 spatial dimensions.
ivy.Container static method variant of ivy.avg_pool1d. This method
simply wraps the function, and so the docstring for ivy.avg_pool1d also
applies to this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – Container of input images [batch_size, w, d_in].
kernel (Union[int, Tuple[int], Container]) – Size of the kernel i.e., the sliding window for each
dimension of input. [w].
strides (Union[int, Tuple[int], Container]) – The stride of the sliding window for each dimension of input.
padding (Union[str, Container]) – SAME” or “VALID” indicating the algorithm, or list
indicating the per-dimension paddings.
data_format (Union[str, Container], default: 'NWC') – NWC” or “NCW”. Defaults to “NWC”.
count_include_pad (Union[bool, Container], default: False) – Whether to include padding in the averaging calculation.
ceil_mode (Union[bool, Container], default: False) – Whether to use ceil or floor for creating the output shape.
out (Optional[Container], default: None) – optional output array, for writing the result to.
ivy.Container static method variant of ivy.avg_pool2d. This method
simply wraps the function, and so the docstring for ivy.avg_pool2d also
applies to this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – Input image [batch_size,h,w,d_in].
kernel (Union[int, Tuple[int], Tuple[int, int], Container]) – The size of the window to take a max over.
strides (Union[int, Tuple[int], Tuple[int, int], Container]) – The stride of the sliding window for each dimension of input.
padding (Union[str, Container]) – “SAME” or “VALID” indicating the algorithm, or list indicating
the per-dimension paddings.
data_format (Union[str, Container], default: 'NHWC') – “NHWC” or “NCHW”. Defaults to “NHWC”.
count_include_pad (Union[bool, Container], default: False) – Whether to include padding in the averaging calculation.
ceil_mode (Union[bool, Container], default: False) – Whether to use ceil or floor for creating the output shape.
divisor_override (Optional[Union[int, Container]], default: None) – If specified, it will be used as divisor,
otherwise kernel_size will be used.
out (Optional[Container], default: None) – optional output array, for writing the result to. It must have a shape
that the inputs broadcast to.
ivy.Container static method variant of ivy.avg_pool3d. This method
simply wraps the function, and so the docstring for ivy.avg_pool3d also
applies to this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – Input volume [batch_size,d,h,w,d_in].
ivy.Container static method variant of ivy.dct. This method simply
wraps the function, and so the docstring for ivy.dct also applies to
this method with minimal changes.
Parameters:
x (Container) – Container with the input signals.
type (Union[Literal[1, 2, 3, 4], Container], default: 2) – The type of the dct. Must be 1, 2, 3 or 4.
n (Optional[Union[int, Container]], default: None) – The length of the transform. If n is less than the input signal length,
then x is truncated, if n is larger than x is zero-padded.
norm (Optional[Union[Literal['ortho'], Container]], default: None) – The type of normalization to be applied. Must be either None or “ortho”.
out (Optional[Container], default: None) – optional output container, for writing the result to.
ivy.Container static method variant of ivy.idct. This method simply
wraps the function, and so the docstring for ivy.idct also applies to
this method with minimal changes.
Parameters:
x (Container) – Container with the input signals.
type (Union[Literal[1, 2, 3, 4], Container], default: 2) – The type of the dct. Must be 1, 2, 3 or 4.
n (Optional[Union[int, Container]], default: None) – The length of the transform. If n is less than the input signal length,
then x is truncated, if n is larger than x is zero-padded.
norm (Optional[Union[Literal['ortho'], Container]], default: None) – The type of normalization to be applied. Must be either None or “ortho”.
out (Optional[Container], default: None) – optional output container, for writing the result to.
ivy.Container static method variant of ivy.ifft. This method simply
wraps the function, and so the docstring for ivy.ifft also applies to
this method with minimal changes.
Parameters:
x (Container) – Container containing input volumes […,d_in,…],
where d_in indicates the dimension that needs IFFT.
dim (Union[int, Container]) – The dimension along which to take the one dimensional IFFT.
norm (Union[str, Container], default: 'backward') – Optional argument, “backward”, “ortho” or “forward”. Defaults to be
“backward”.
“backward” indicates no normalization.
“ortho” indicates normalization by 1/sqrt(n).
“forward” indicates normalization by 1/n.
n (Optional[Union[int, Tuple[int], Container]], default: None) – Optional argument indicating the sequence length, if given, the input would
be padded with zero or truncated to length n before performing IFFT.
Should be a integer greater than 1.
out (Optional[Container], default: None) – Optional output array, for writing the result to. It must have a shape that
the inputs broadcast to.
This method simply wraps the function, and so the docstring for
ivy.ifftn also applies to this method with minimal changes.
Parameters:
x (Container) – Input array of complex numbers.
s (Optional[Union[int, Tuple[int, ...], Container]], default: None) – sequence of ints, optional
Shape (length of transformed axis) of the output (s[0] refers to axis 0,
s[1] to axis 1, etc.). If given shape is smaller than that of the input,
the input is cropped. If larger, input is padded with zeros. If s is not
given, shape of input along axes specified by axes is used.
axes (Optional[Union[int, Tuple[int, ...], Container]], default: None) – axes over which to compute the IFFT. If not given, last len(s) axes are
used, or all axes if s is also not specified. Repeated indices in axes
means inverse transform over that axis is performed multiple times.
norm (Union[str, Container], default: 'backward') – Optional argument, “backward”, “ortho” or “forward”.
Defaults to be “backward”.
“backward” indicates no normalization.
“ortho” indicates normalization by 1/sqrt(n).
“forward” indicates normalization by 1/n.
out (Optional[Container], default: None) – Optional output array, for writing the result to. It must have a shape that
the inputs broadcast to.
Returns:
ret – The truncated or zero-padded input, transformed along the axes indicated
by axes, or by a combination of s or x, as explained in the parameters
section above.
mode (Union[Literal['linear', 'bilinear', 'trilinear', 'nearest', 'area', 'nearest_exact', 'tf_area', 'bicubic'], Container], default: 'linear') – Interpolation mode. Can be one of the following:
- linear
- bilinear
- trilinear
- nearest
- area
- tf_area
- bicubic
- mitchellcubic
- lanczos3
- lanczos5
- gaussian
scale_factor (Optional[Union[int, Sequence[int], Container]], default: None) – Multiplier for spatial size that defines the output
size (overwriting size).
align_corners (Optional[Union[bool, Container]], default: None) – If True, the corner pixels of the input and output tensors are aligned,
and thus preserving the values at the corner pixels. If False, the corner
pixels are not aligned, and the interpolation uses edge value padding for
out-of-boundary values.
only has an effect when mode is ‘linear’, ‘bilinear’,
‘bicubic’ or ‘trilinear’. Default: False
antialias (Union[bool, Container], default: False) – If True, antialiasing is applied when downsampling an image.
Supported modes: ‘bilinear’, ‘bicubic’.
out (Optional[Container], default: None) – Optional output array, for writing the result to. It must
have a shape that the inputs broadcast to.
ivy.Container static method variant of ivy.max_pool1d. This method
simply wraps the function, and so the docstring for ivy.max_pool1d also
applies to this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – Container of input images [batch_size, w, d_in].
kernel (Union[int, Tuple[int, ...], Container]) – Size of the kernel i.e., the sliding window for each
dimension of input. [w].
strides (Union[int, Tuple[int, ...], Container]) – The stride of the sliding window for each dimension of input.
padding (Union[str, int, Tuple[int], List[Tuple[int, int]], Container]) – “SAME” or “VALID” indicating the algorithm, or list
indicating the per-dimension paddings.
data_format (Union[str, Container], default: 'NWC') – “NWC” or “NCW”. Defaults to “NWC”.
dilaton – The stride between elements within a sliding window, must be > 0.
ceil_mode (Union[bool, Container], default: False) – If True, ceil is used instead of floor to compute the output shape.
This ensures that every element is covered by a sliding window.
out (Optional[Container], default: None) – optional output array, for writing the result to.
ivy.Container static method variant of ivy.max_pool2dd. This method
simply wraps the function, and so the docstring for ivy.max_pool2d also
applies to this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – Input image [batch_size,h,w,d_in].
kernel (Union[int, Tuple[int, ...], Container]) – The size of the window to take a max over.
strides (Union[int, Tuple[int, ...], Container]) – The stride of the sliding window for each dimension of input.
padding (Union[str, int, Tuple[int], List[Tuple[int, int]], Container]) – “SAME” or “VALID” indicating the algorithm, or list indicating
the per-dimension paddings.
data_format (Union[str, Container], default: 'NHWC') – “NHWC” or “NCHW”. Defaults to “NHWC”.
dilaton – The stride between elements within a sliding window, must be > 0.
ceil_mode (Union[bool, Container], default: False) – If True, ceil is used instead of floor to compute the output shape.
This ensures that every element is covered by a sliding window.
out (Optional[Container], default: None) – optional output array, for writing the result to. It must have a shape
that the inputs broadcast to.
ivy.Container static method variant of ivy.max_pool3d. This method
simply wraps the function, and so the docstring for ivy.max_pool3d also
applies to this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – Input volume [batch_size,d,h,w,d_in].
strides (Union[int, Tuple[int, ...], Container]) – The stride of the sliding window for each dimension of input.
padding (Union[str, int, Tuple[int], List[Tuple[int, int]], Container]) – SAME” or “VALID” indicating the algorithm, or list indicating
the per-dimension paddings.
data_format (Union[str, Container], default: 'NDHWC') – “NDHWC” or “NCDHW”. Defaults to “NDHWC”.
dilaton – The stride between elements within a sliding window, must be > 0.
ceil_mode (Union[bool, Container], default: False) – If True, ceil is used instead of floor to compute the output shape.
This ensures that every element is covered by a sliding window.
out (Optional[Container], default: None) – optional output array, for writing the result to. It must
have a shape that the inputs broadcast to.
ivy.Container static method variant of ivy.max_unpool1d.
Parameters:
input (Container) – Pooled input image [batch_size, w, d_in].
indices (Container) – Indices obtained from the corresponding max pooling operation.
kernel_size (Union[Tuple[int], int]) – Size of the kernel i.e., the sliding window for each
dimension of input. [w].
strides (Optional[Union[int, Tuple[int]]], default: None) – The stride of the sliding window for each dimension of input.
padding (Union[int, Tuple[int]], default: 0) – SAME” or “VALID” indicating the algorithm, or list
indicating the per-dimension paddings.
data_format (Union[str, Container], default: 'NCW') – NWC” or “NCW”. Defaults to “NCW”.
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.
This method simply wraps the function, and so the docstring for
ivy.rfft also applies to this method with minimal changes.
Parameters:
x (Container) – input array. Must have a real-valued floating-point data type.
n (Optional[Union[int, Container]], default: None) – length of the transformed axis of the input. If
- n is greater than the length of the input array, the input array
is zero-padded to length n.
- n is less than the length of the input array, the input array is
trimmed to length n.
- n is not provided, the length of the transformed axis of the
output must equal the length of the input along the axis specified
by axis. Default is None.
axis (Union[int, Container], default: -1) – axis (dimension) over which to compute the Fourier transform.
If not set, the last axis (dimension) is used. Default is -1.
norm (Union[Literal['backward', 'ortho', 'forward'], Container], default: 'backward') – normalization mode. Should be one of the following modes:
- ‘backward’: no normalization.
- ‘ortho’: normalize by 1/sqrt(n) (i.e., make the FFT orthonormal).
- ‘forward’: normalize by 1/n.
Default is backward.
out (Optional[Union[Array, Container]], default: None) – Optional output array, for writing the result to. It must
have a shape that the inputs broadcast to.
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.
Return type:
Container
Returns:
ret – an array transformed along the axis (dimension) indicated by axis.
The returned array must have a complex-valued floating-point
data type determined by Type Promotion Rules.
This method simply wraps the function, and so the docstring for
ivy.rfftn also applies to this method with minimal changes.
Parameters:
x (Container) – Input array of real numbers.
s (Optional[Union[int, Tuple[int, ...], Container]], default: None) – sequence of ints, optional
Shape (length of transformed axis) to use from the input (s[0] refers to
axis 0,`s[1]` to axis 1, etc.). The final element of s corresponds to n
for rfft(x, n), while for the remaining axes, it corresponds to n for
fft(x, n). Along any axis, if the given shape is smaller than that of the
input, the input is cropped. If it is larger,the input is padded with zeros.
If s is not given, the shape of the input along the axes specified by
axes is used.
axes (Optional[Union[int, Tuple[int, ...], Container]], default: None) – sequence of ints, optional
Axes over which to compute the FFT. If not given, the last len(s) axes
are used, or all axes if s is also not specified.
norm (Union[str, Container], default: 'backward') – Optional argument, “backward”, “ortho” or “forward”.
Defaults to be “backward”.
“backward” indicates no normalization.
“ortho” indicates normalization by 1/sqrt(n).
“forward” indicates normalization by 1/n.
out (Optional[Container], default: None) – Optional output array, for writing the result to. It must have a shape that
the inputs broadcast to.
Return type:
Container
Returns:
ret – The truncated or zero-padded input, transformed along the axes indicated by
axes or by a combination of s or x, as explained in the parameters
section above.
inputs (Array) – Array of temporal data of shape (samples, time, …).
initial_states (List[Array]) – Array with shape (samples, state_size).
go_backwards (bool, default: False) – If True, do the iteration over the time dimension in reverse order and
return the reversed sequence.
mask (Optional[Array], default: None) – Binary array with shape (samples, time, 1), with a zero for every element
that is masked.
constants (Optional[Array], default: None) – List of constant values passed at each step.
unroll (bool, default: False) – Whether to use a pythonic while loop or ivy.while_loop
input_length (Optional[int], default: None) – An integer or 1-D array, depending on whether the time dimension is
fixed-length. In case of variable length input, it is used for masking in
case there is no mask specified.
time_major (bool, default: False) – If True, the inputs and outputs will be in shape (timesteps, batch, …)
whereas in the False case, it will be (batch, timesteps, …).
zero_output_for_mask (bool, default: False) – If True, the otput for masked timestep will be zeros, whereas in the False
case, output from previous timestep is returned
return_all_outputs (bool, default: True) – If True, return the recurrent outputs for all timesteps in the sequence. If
False, only return the output for the last timestep.
Return type:
Container
Returns:
ret – A tuple of
- the latest output of the rnn of shape (samples, …)
- the output of the rnn of shape (samples, time, …) if
return_all_outputs=True else (samples, 1, …)
list of tensors, latest states returned by the step funciton, of shape
(samples, …)
This method simply wraps the function, and so the docstring for
ivy.stft also applies to this method with minimal changes.
Parameters:
signals (Container) – Input Arrays.
frame_length (Union[int, Container]) – An integer scalar Tensor. The window length in samples.
frame_step (Union[int, Container]) – An integer scalar Tensor. The number of samples to step.
fft_length (Optional[Union[int, Container]], default: None) – An integer scalar Tensor. The size of the FFT to apply.
If not provided, uses the smallest power of 2 enclosing frame_length.
optional – An integer scalar Tensor. The size of the FFT to apply.
If not provided, uses the smallest power of 2 enclosing frame_length.
window_fn (Optional[Union[Callable, Container]], default: None) – A callable that takes a window length
and a dtype keyword argument and returns a [window_length]
Tensor of samples in the provided datatype.
If set to None, no windowing is used.
optional – A callable that takes a window length
and a dtype keyword argument and returns a [window_length]
Tensor of samples in the provided datatype.
If set to None, no windowing is used.
pad_end (Optional[Union[bool, Container]], default: False) – Whether to pad the end of signals with zeros when the provided frame length
and step produces a frame that lies partially past its end.
optional – Whether to pad the end of signals with zeros when the provided frame length
and step produces a frame that lies partially past its end.
name (Optional[Union[str, Container]], default: None) – An optional name for the operation.
optional – An optional name for the operation.
out (Optional[Container], default: None) – Optional output array for writing the result.
optional – Optional output array for writing the result.
Return type:
Container
Returns:
ret – A […, frames, fft_unique_bins] Tensor of
complex64/complex128 STFT values where fft_unique_bins is
fft_length // 2 + 1 (the unique components of the FFT).
frame_length (Union[int, Container]) – An integer scalar Tensor. The window length in samples.
frame_step (Union[int, Container]) – An integer scalar Tensor. The number of samples to step.
fft_length (Optional[Union[int, Container]], default: None) – An integer scalar Tensor. The size of the FFT to apply.
If not provided, uses the smallest power of 2 enclosing frame_length.
window_fn (Optional[Union[Callable, Container]], default: None) – A callable that takes a window length and
a dtype keyword argument and returns a [window_length] Tensor of
samples in the provided datatype. If set to None, no windowing is used.
pad_end (Optional[Union[bool, Container]], default: False) – Whether to pad the end of signals with zeros when the provided frame length
and step produces a frame that lies partially past its end.
name (Optional[Union[str, Container]], default: None) – An optional name for the operation.
out (Optional[Union[Array, Container]], default: None) – Optional output array for writing the result.
Return type:
Container
Returns:
ret – A […, frames, fft_unique_bins] Tensor of
complex64/complex128 STFT values where fft_unique_bins is
fft_length // 2 + 1 (the unique components of the FFT).
ivy.Container instance method variant of ivy.adjoint. This method
simply wraps the function, and so the docstring for ivy.adjoint also
applies to this method with minimal changes.
ivy.Container instance method variant of ivy.batched_outer. This
method simply wraps the function, and so the docstring for
ivy.batched_outer also applies to this method with minimal changes.
Parameters:
tensors (Sequence[Union[Container, Array, NativeArray]]) – list of tensors of shape (n_samples, J1, …, JN) ,
(n_samples, K1, …, KM) …
Return type:
Container
Returns:
outer product of tensors – of shape (n_samples, J1, …, JN, K1, …, KM, …)
ivy.Container instance method variant of ivy.cond. This method
simply wraps the function, and so the docstring for ivy.cond also
applies to this method with minimal changes.
Parameters:
self (Container) – container with input arrays.
p (Optional[Union[int, float, Container]], default: None) – order of the norm of the matrix (see ivy.norm).
Returns:
ret
container including array corresponding
to condition number of input array
ivy.Container instance method variant of ivy.diagflat. This method
simply wraps the function, and so the docstring for ivy.diagflat also
applies to this method with minimal changes.
Compute the dot product between two arrays a and b using the
current backend’s implementation. The dot product is defined as the sum
of the element- wise product of the input arrays.
Parameters:
self (Union[Array, NativeArray, Container]) – First input array.
b (Union[Array, NativeArray, Container]) – Second input array.
out (Optional[Union[Array, Container]], default: None) – Optional output array. If provided, the output array to store the result.
ivy.Container instance method variant of ivy.eig. This method simply
wraps the function, and so the docstring for ivy.eig also applies to
this method with minimal changes.
Parameters:
x – container with input arrays.
Return type:
Container
Returns:
ret
container including arrays corresponding
eigenvealues and eigenvectors of input arrays
ivy.Container instance method variant of ivy.eigh_tridiagonal. This
method simply wraps the function, and so the docstring for
ivy.eigh_tridiagonal also applies to this method with minimal changes.
Parameters:
self (Container) – A container of real or complex arrays each of shape (n),
the diagonal elements of the matrix.
beta (Union[Array, NativeArray, Container]) – An array or a container of real or complex arrays each of shape
(n-1), containing the elements of the first super-diagonal of the matrix.
eigvals_only (Union[bool, Container], default: True) – If False, both eigenvalues and corresponding eigenvectors are computed.
If True, only eigenvalues are computed. Default is True.
select (Union[str, Container], default: 'a') – Optional string with values in {‘a’, ‘v’, ‘i’} (default is ‘a’) that
determines which eigenvalues to calculate: ‘a’: all eigenvalues.
‘v’: eigenvalues in the interval (min, max] given by select_range.
‘i’: eigenvalues with indices min <= i <= max.
select_range (Optional[Union[Tuple[int, int], List[int], Array, NativeArray, Container]], default: None) – Size 2 tuple or list or array specifying the range of eigenvalues to
compute together with select. If select is ‘a’, select_range is ignored.
tol (Optional[Union[float, Container]], default: None) – Optional scalar. Ignored when backend is not Tensorflow. The absolute
tolerance to which each eigenvalue is required. An eigenvalue (or cluster)
is considered to have converged if it lies in an interval of this width.
If tol is None (default), the value eps*|T|_2 is used where eps is the
machine precision, and |T|_2 is the 2-norm of the matrix T.
Return type:
Union[Container, Tuple[Container, Container]]
Returns:
eig_vals – The eigenvalues of the matrix in non-decreasing order.
eig_vectors – If eigvals_only is False the eigenvectors are returned in
the second output argument.
ivy.Container instance method variant of ivy.eigvals. This method
simply wraps the function, and so the docstring for ivy.eigvals also
applies to this method with minimal changes.
Parameters:
x – container with input arrays.
Return type:
Container
Returns:
ret
container including array corresponding
to eigenvalues of input array
ivy.Container instance method variant of ivy.higher_order_moment.
This method simply wraps the function, and so the docstring for
ivy.higher_order_moment also applies to this method with minimal
changes.
Parameters:
x – matrix of size (n_samples, n_features)
or tensor of size(n_samples, D1, …, DN)
order (Union[Sequence[int], Container]) – number of the higher-order moment to compute
Return type:
Container
Returns:
tensor – if tensor is a matrix of size (n_samples, n_features),
tensor of size (n_features, )*order
ivy.Container instance method variant of ivy.initialize_tucker. This
method simply wraps the function, and so the docstring for
ivy.initialize_tucker also applies to this method with minimal changes.
Parameters:
x – input tensor
rank (Union[Sequence[int], Container]) – number of components
modes (Union[Sequence[int], Container]) – modes to consider in the input tensor
seed (Optional[Union[int, Container]], default: None) – Used to create a random seed distribution
when init == ‘random’
svd (Optional[Union[Literal['truncated_svd'], Container]], default: 'truncated_svd') – function to use to compute the SVD
non_negative (Optional[Union[bool, Container]], default: False) – if True, non-negative factors are returned
mask (Optional[Union[Array, NativeArray, Container]], default: None) – array of booleans with the same shape as tensor should be 0 where
the values are missing and 1 everywhere else. Note: if tensor is
sparse, then mask should also be sparse with a fill value of 1 (or
True).
svd_mask_repeats (Optional[Union[int, Container]], default: 5) – number of iterations for imputing the values in the SVD matrix when
mask is not None
ivy.Container instance method variant of ivy.kron. This method
simply wraps the function, and so the docstring for ivy.kron also
applies to this method with minimal changes.
ivy.Container instance method variant of ivy.make_svd_non_negative.
This method simply wraps the function, and so the docstring for
ivy.make_svd_non_negative applies to this method with minimal changes.
Parameters:
self (Union[Array, NativeArray, Container]) – tensor being decomposed.
U (Union[Array, NativeArray, Container]) – left singular matrix from SVD.
S (Union[Array, NativeArray, Container]) – diagonal matrix from SVD.
V (Union[Array, NativeArray, Container]) – right singular matrix from SVD.
nntype (Optional[Union[Literal['nndsvd', 'nndsvda'], Container]], default: 'nndsvd') – whether to fill small values with 0.0 (nndsvd),
or the tensor mean (nndsvda, default).
ivy.Container instance method variant of ivy.diagflat. This method
simply wraps the function, and so the docstring for ivy.diagflat also
applies to this method with minimal changes.
ivy.Container instance method variant of ivy.mode_dot. This method
simply wraps the function, and so the docstring for ivy.mode_dot also
applies to this method with minimal changes.
Parameters:
x – tensor of shape (i_1,...,i_k,...,i_N)
matrix_or_vector (Union[Array, NativeArray, Container]) – 1D or 2D array of shape (J,i_k) or (i_k,)
matrix or vectors to which to n-mode multiply the tensor
mode (Union[int, Container]) – int in the range(1, N)
transpose (Optional[Union[bool, Container]], default: False) – If True, the matrix is transposed.
For complex tensors, the conjugate transpose is used.
out (Optional[Container], default: None) – optional output array, for writing the result to.
It must have a shape that the result can broadcast to.
Returns:
ivy.Container – mode-mode product of tensor by matrix_or_vector
* of shape \((i_1, ..., i_{k-1}, J, i_{k+1}, ..., i_N)\)
if matrix_or_vector is a matrix
* of shape \((i_1, ..., i_{k-1}, i_{k+1}, ..., i_N)\)
if matrix_or_vector is a vector
ivy.Container instance method variant of ivy.multi_dot. This method
simply wraps the function, and so the docstring for ivy.multi_dot also
applies to this method with minimal changes.
ivy.Container instance method variant of ivy.multi_mode_dot. This
method simply wraps the function, and so the docstring for
ivy.multi_mode_dot also applies to this method with minimal changes.
Parameters:
self (Union[Array, NativeArray, Container]) – the input tensor
mat_or_vec_list (Sequence[Union[Container, Array, NativeArray]]) – sequence of matrices or vectors of length tensor.ndim
modes (Optional[Union[Sequence[int], Container]], default: None) – None or int list, optional, default is None
skip (Optional[Union[Sequence[int], Container]], default: None) – None or int, optional, default is None
If not None, index of a matrix to skip.
transpose (Optional[Union[bool, Container]], default: False) – If True, the matrices or vectors in in the list are transposed.
For complex tensors, the conjugate transpose is used.
out (Optional[Container], default: None) – optional output array, for writing the result to.
It must have a shape that the result can broadcast to.
Return type:
Container
Returns:
ivy.Container – tensor times each matrix or vector in the list at mode mode
ivy.Container static method variant of ivy.partial_tucker. This
method simply wraps the function, and so the docstring for
ivy.partial_tucker also applies to this method with minimal changes.
svd (Optional[Union[Literal['truncated_svd'], Container]], default: 'truncated_svd') – function to use to compute the SVD
mask (Optional[Union[Array, NativeArray, Container]], default: None) – array of booleans with the same shape as tensor should be 0 where
the values are missing and 1 everywhere else. Note: if tensor is
sparse, then mask should also be sparse with a fill value of 1 (or
True).
svd_mask_repeats (Optional[Union[int, Container]], default: 5) – number of iterations for imputing the values in the SVD matrix when
mask is not None
ivy.Container static method variant of ivy.adjoint. This method
simply wraps the function, and so the docstring for ivy.adjoint also
applies to this method with minimal changes.
Parameters:
x (Container) – container with input arrays of dimensions greater than 1.
out (Optional[Container], default: None) – optional output container, for writing the result to.
Returns:
ret – container including arrays corresponding to the conjugate transpose of
the arrays in the input container
ivy.Container static method variant of ivy.batched_outer. This
method simply wraps the function, and so the docstring for
ivy.batched_outer also applies to this method with minimal changes.
Parameters:
tensors (Sequence[Union[Container, Array, NativeArray]]) – list of tensors of shape (n_samples, J1, …, JN) ,
(n_samples, K1, …, KM) …
Return type:
Container
Returns:
outer product of tensors – of shape (n_samples, J1, …, JN, K1, …, KM, …)
ivy.Container static method variant of ivy.cond. This method simply
wraps the function, and so the docstring for ivy.cond also applies to
this method with minimal changes.
Parameters:
x (Container) – container with input arrays.
p (Optional[Union[int, float, Container]], default: None) – order of the norm of the matrix (see ivy.norm).
Returns:
ret
container including array corresponding
to condition number of input array
Compute the dot product between two arrays a and b using the
current backend’s implementation. The dot product is defined as the sum
of the element- wise product of the input arrays.
Parameters:
a (Union[Array, NativeArray, Container]) – First input array.
b (Union[Array, NativeArray, Container]) – Second input array.
out (Optional[Union[Array, Container]], default: None) – Optional output array. If provided, the output array to store the result.
ivy.Container static method variant of ivy.eig. This method simply
wraps the function, and so the docstring for ivy.eig also applies to
this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – container with input arrays.
Return type:
Container
Returns:
ret
container including tuple of arrays corresponding to
eigenvealues and eigenvectors of input array
ivy.Container static method variant of ivy.eigh_tridiagonal. This
method simply wraps the function, and so the docstring for
ivy.eigh_tridiagonal also applies to this method with minimal changes.
Parameters:
alpha (Union[Array, NativeArray, Container]) – An array or a container of real or complex arrays each of
shape (n), the diagonal elements of the matrix.
beta (Union[Array, NativeArray, Container]) – An array or a container of real or complex arrays each of shape (n-1),
containing the elements of the first super-diagonal of the matrix.
eigvals_only (Union[bool, Container], default: True) – If False, both eigenvalues and corresponding eigenvectors are computed.
If True, only eigenvalues are computed. Default is True.
select (Union[str, Container], default: 'a') – Optional string with values in {‘a’, ‘v’, ‘i’}
(default is ‘a’) that determines which eigenvalues
to calculate: ‘a’: all eigenvalues. ‘v’: eigenvalues
in the interval (min, max] given by select_range.
‘i’: eigenvalues with indices min <= i <= max.
select_range (Optional[Union[Tuple[int, int], List[int], Array, NativeArray, Container]], default: None) – Size 2 tuple or list or array specifying the range of
eigenvalues to compute together with select. If select
is ‘a’, select_range is ignored.
tol (Optional[Union[float, Container]], default: None) – Optional scalar. Ignored when backend is not Tensorflow. The
absolute tolerance to which each eigenvalue is required. An
eigenvalue (or cluster) is considered to have converged if
it lies in an interval of this width. If tol is None (default),
the value eps*|T|_2 is used where eps is the machine precision,
and |T|_2 is the 2-norm of the matrix T.
Return type:
Union[Container, Tuple[Container, Container]]
Returns:
eig_vals – The eigenvalues of the matrix in non-decreasing order.
eig_vectors – If eigvals_only is False the eigenvectors are returned in the second
output argument.
ivy.Container static method variant of ivy.eigvals. This method
simply wraps the function, and so the docstring for ivy.eigvals also
applies to this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – container with input arrays.
Return type:
Container
Returns:
ret
container including array corresponding
to eigenvalues of input array
ivy.Container static method variant of ivy.higher_order_moment. This
method simply wraps the function, and so the docstring for
ivy.higher_order_moment also applies to this method with minimal
changes.
Parameters:
x (Union[Array, NativeArray, Container]) – matrix of size (n_samples, n_features)
or tensor of size(n_samples, D1, …, DN)
order (Union[Sequence[int], Container]) – number of the higher-order moment to compute
Return type:
Container
Returns:
tensor – if tensor is a matrix of size (n_samples, n_features),
tensor of size (n_features, )*order
ivy.Container static method variant of ivy.initialize_tucker. This
method simply wraps the function, and so the docstring for
ivy.initialize_tucker also applies to this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – input tensor
rank (Union[Sequence[int], Container]) – number of components
modes (Union[Sequence[int], Container]) – modes to consider in the input tensor
seed (Optional[Union[int, Container]], default: None) – Used to create a random seed distribution
when init == ‘random’
svd (Optional[Union[Literal['truncated_svd'], Container]], default: 'truncated_svd') – function to use to compute the SVD
non_negative (Optional[Union[bool, Container]], default: False) – if True, non-negative factors are returned
mask (Optional[Union[Array, NativeArray, Container]], default: None) – array of booleans with the same shape as tensor should be 0 where
the values are missing and 1 everywhere else. Note: if tensor is
sparse, then mask should also be sparse with a fill value of 1 (or
True).
svd_mask_repeats (Optional[Union[int, Container]], default: 5) – number of iterations for imputing the values in the SVD matrix when
mask is not None
ivy.Container static method variant of ivy.kron. This method simply
wraps the function, and so the docstring for ivy.kron also applies to
this method with minimal changes.
Parameters:
a (Union[Array, NativeArray, Container]) – first container with input arrays.
b (Union[Array, NativeArray, Container]) – second container with input arrays
out (Optional[Container], default: None) – optional output container, for writing the result to.
Return type:
Container
Returns:
ret – container including arrays corresponding to the Kronecker product of
the arrays in the input containers, computed element-wise
ivy.Container static method variant of ivy.make_svd_non_negative.
This method simply wraps the function, and so the docstring for
ivy.make_svd_non_negative also applies to this method with minimal
changes.
Parameters:
x (Union[Array, NativeArray, Container]) – tensor being decomposed.
U (Union[Array, NativeArray, Container]) – left singular matrix from SVD.
S (Union[Array, NativeArray, Container]) – diagonal matrix from SVD.
V (Union[Array, NativeArray, Container]) – right singular matrix from SVD.
nntype (Optional[Union[Literal['nndsvd', 'nndsvda'], Container]], default: 'nndsvd') – whether to fill small values with 0.0 (nndsvd),
or the tensor mean (nndsvda, default).
ivy.Container static method variant of ivy.mode_dot. This method
simply wraps the function, and so the docstring for ivy.mode_dot also
applies to this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – tensor of shape (i_1,...,i_k,...,i_N)
matrix_or_vector (Union[Array, NativeArray, Container]) – 1D or 2D array of shape (J,i_k) or (i_k,)
matrix or vectors to which to n-mode multiply the tensor
mode (Union[int, Container]) – int in the range(1, N)
transpose (Optional[Union[bool, Container]], default: False) – If True, the matrix is transposed.
For complex tensors, the conjugate transpose is used.
out (Optional[Container], default: None) – optional output array, for writing the result to.
It must have a shape that the result can broadcast to.
Return type:
Container
Returns:
ivy.Container – mode-mode product of tensor by matrix_or_vector
* of shape \((i_1, ..., i_{k-1}, J, i_{k+1}, ..., i_N)\)
if matrix_or_vector is a matrix
* of shape \((i_1, ..., i_{k-1}, i_{k+1}, ..., i_N)\)
if matrix_or_vector is a vector
ivy.Container static method variant of ivy.multi_dot. This method
simply wraps the function, and so the docstring for ivy.multi_dot also
applies to this method with minimal changes.
Parameters:
x (Sequence[Union[Container, Array, NativeArray]]) – sequence of matrices to multiply.
out (Optional[Container], default: None) – optional output array, for writing the result to. It must have a valid
shape, i.e. the resulting shape after applying regular matrix multiplication
to the inputs.
ivy.Container static method variant of ivy.multi_mode_dot. This
method simply wraps the function, and so the docstring for
ivy.multi_mode_dot also applies to this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – the input tensor
mat_or_vec_list (Sequence[Union[Container, Array, NativeArray]]) – sequence of matrices or vectors of length tensor.ndim
skip (Optional[Union[Sequence[int], Container]], default: None) – None or int, optional, default is None
If not None, index of a matrix to skip.
modes (Optional[Union[Sequence[int], Container]], default: None) – None or int list, optional, default is None
transpose (Optional[Union[bool, Container]], default: False) – If True, the matrices or vectors in in the list are transposed.
For complex tensors, the conjugate transpose is used.
out (Optional[Container], default: None) – optional output array, for writing the result to.
It must have a shape that the result can broadcast to.
Return type:
Container
Returns:
ivy.Container – tensor times each matrix or vector in the list at mode mode
ivy.Container static method variant of ivy.partial_tucker. This
method simply wraps the function, and so the docstring for
ivy.partial_tucker also applies to this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – input tensor
rank (Union[Sequence[int], Container]) – number of components
modes (Union[Sequence[int], Container]) – modes to consider in the input tensor
seed (Optional[Union[int, Container]], default: None) – Used to create a random seed distribution
when init == ‘random’
svd (Optional[Union[Literal['truncated_svd'], Container]], default: 'truncated_svd') – function to use to compute the SVD
mask (Optional[Union[Array, NativeArray, Container]], default: None) – array of booleans with the same shape as tensor should be 0 where
the values are missing and 1 everywhere else. Note: if tensor is
sparse, then mask should also be sparse with a fill value of 1 (or
True).
svd_mask_repeats (Optional[Union[int, Container]], default: 5) – number of iterations for imputing the values in the SVD matrix when
mask is not None
ivy.Container static method variant of ivy.svd_flip. This method
simply wraps the function, and so the docstring for ivy.svd_flip also
applies to this method with minimal changes.
Parameters:
U (Union[Array, NativeArray, Container]) – left singular matrix output of SVD
V (Union[Array, NativeArray, Container]) – right singular matrix output of SVD
u_based_decision (Optional[Union[bool, Container]], default: True) – If True, use the columns of u as the basis for sign flipping.
Otherwise, use the rows of v. The choice of which variable to base the
decision on is generally algorithm dependent.
Return type:
Tuple[Container, Container]
Returns:
u_adjusted, v_adjusted (container with the same dimensions as the input.)
ivy.Container static method variant of ivy.tensor_train. This method
simply wraps the function, and so the docstring for ivy.tensor_train
also applies to this method with minimal changes.
Parameters:
input_tensor (Union[Array, NativeArray, Container]) – tensor to be decomposed.
rank (Union[Sequence[int], Container]) – maximum allowable TT-ranks of the decomposition.
svd (Optional[Union[Literal['truncated_svd'], Container]], default: 'truncated_svd') – SVD method to use.
verbose (Optional[Union[bool, Container]], default: False) – level of verbosity.
ivy.Container static method variant of ivy.truncated_svd. This
method simply wraps the function, and so the docstring for
ivy.truncated_svd also applies to this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – Container of 2D-arrays
compute_uv (Union[bool, Container], default: True) – If True then left and right singular vectors
will be computed and returned in U and Vh,
respectively. Otherwise, only the singular values
will be computed, which can be significantly faster.
n_eigenvecs (Optional[Union[int, Container]], default: None) – if specified, number of eigen[vectors-values] to return
else full matrices will be returned
ivy.Container static method variant of ivy.tt_matrix_to_tensor. This
method simply wraps the function, and so the docstring for
ivy.tt_matrix_to_tensor also applies to this method with minimal
changes.
Parameters:
tt_matrix (Union[Array, NativeArray, Container]) – array of 4D-arrays
TT-Matrix factors (known as core) of shape
(rank_k, left_dim_k, right_dim_k, rank_{k+1})
out (Optional[Container], default: None) – optional output container, for writing the result to.
Return type:
Container
Returns:
output_tensor – tensor whose TT-Matrix decomposition was given by ‘factors’
ivy.Container static method variant of ivy.tucker. This method
simply wraps the function, and so the docstring for ivy.tucker also
applies to this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – input tensor
rank (Union[Sequence[int], Container]) – size of the core tensor, (len(ranks)==tensor.ndim)
if int, the same rank is used for all modes
fixed_factors (Optional[Union[Sequence[int], Container]], default: None) – if not None, list of modes for which to keep the factors fixed.
Only valid if a Tucker tensor is provided as init.
n_iter_max (Optional[Union[int, Container]], default: 100) – maximum number of iteration
init (Optional[Union[Literal['svd', 'random'], TuckerTensor, Container]], default: 'svd') – {‘svd’, ‘random’}, or TuckerTensor optional
if a TuckerTensor is provided, this is used for initialization
svd (Optional[Union[Literal['truncated_svd'], Container]], default: 'truncated_svd') – str, default is ‘truncated_svd’
function to use to compute the SVD,
seed (Optional[Union[int, Container]], default: None) – Used to create a random seed distribution
when init == ‘random’
mask (Optional[Union[Array, NativeArray, Container]], default: None) – array of booleans with the same shape as tensor should be 0 where
the values are missing and 1 everywhere else. Note: if tensor is
sparse, then mask should also be sparse with a fill value of 1 (or
True).
svd_mask_repeats (Optional[Union[int, Container]], default: 5) – number of iterations for imputing the values in the SVD matrix when
mask is not None
tol (Optional[Union[float, Container]], default: 0.0001) – tolerance: the algorithm stops when the variation in
the reconstruction error is less than the tolerance
verbose (Optional[Union[bool, Container]], default: False) – if True, different in reconstruction errors are returned at each
iteration.
return_errors (Optional[Union[bool, Container]], default: False) – Indicates whether the algorithm should return all reconstruction errors
and computation time of each iteration or not
Default: False
Return type:
Tuple[Container, Sequence[Container]]
Returns:
Container of ivy.TuckerTensors or ivy.TuckerTensors and
container of reconstruction errors if return_errors is True.
ivy.Container instance method variant of ivy.svd_flip. This method
simply wraps the function, and so the docstring for ivy.svd_flip
applies to this method with minimal changes.
Parameters:
self (Union[Array, NativeArray, Container]) – left singular matrix output of SVD
V (Union[Array, NativeArray, Container]) – right singular matrix output of SVD
u_based_decision (Optional[Union[bool, Container]], default: True) – If True, use the columns of u as the basis for sign flipping.
Otherwise, use the rows of v. The choice of which variable to base the
decision on is generally algorithm dependent.
Return type:
Tuple[Container, Container]
Returns:
u_adjusted, v_adjusted (container with the same dimensions as the input.)
ivy.Container instance method variant of ivy.tensor_train. This
method simply wraps the function, and so the docstring for
ivy.tensor_train also applies to this method with minimal changes.
Parameters:
input_tensor – tensor to be decomposed.
rank (Union[Sequence[int], Container]) – maximum allowable TT-ranks of the decomposition.
svd (Optional[Union[Literal['truncated_svd'], Container]], default: 'truncated_svd') – SVD method to use.
verbose (Optional[Union[bool, Container]], default: False) – level of verbosity.
ivy.Container instance method variant of ivy.truncated_svd. This
method simply wraps the function, and so the docstring for
ivy.truncated_svd also applies to this method with minimal changes.
Parameters:
x – Container of 2D-arrays
compute_uv (Union[bool, Container], default: True) – If True then left and right singular vectors
will be computed and returned in U and Vh
respectively. Otherwise, only the singular values will
be computed, which can be significantly faster.
n_eigenvecs (Optional[Union[int, Container]], default: None) – if specified, number of eigen[vectors-values] to return
else full matrices will be returned
ivy.Container instance method variant of ivy.tt_matrix_to_tensor.
This method simply wraps the function, and so the docstring for
ivy.tt_matrix_to_tensor also applies to this method with minimal
changes.
Parameters:
tt_matrix – array of 4D-arrays
TT-Matrix factors (known as core) of shape
(rank_k, left_dim_k, right_dim_k, rank_{k+1})
out (Optional[Container], default: None) – optional output container, for writing the result to.
Return type:
Container
Returns:
output_tensor – tensor whose TT-Matrix decomposition was given by ‘factors’
ivy.Container static method variant of ivy.tucker. This method
simply wraps the function, and so the docstring for ivy.tucker also
applies to this method with minimal changes.
Parameters:
x – input tensor
rank (Union[Sequence[int], Container]) – size of the core tensor, (len(ranks)==tensor.ndim)
if int, the same rank is used for all modes
fixed_factors (Optional[Union[Sequence[int], Container]], default: None) – if not None, list of modes for which to keep the factors fixed.
Only valid if a Tucker tensor is provided as init.
n_iter_max (Optional[Union[int, Container]], default: 100) – maximum number of iteration
init (Optional[Union[Literal['svd', 'random'], TuckerTensor, Container]], default: 'svd') – {‘svd’, ‘random’}, or TuckerTensor optional
if a TuckerTensor is provided, this is used for initialization
svd (Optional[Union[Literal['truncated_svd'], Container]], default: 'truncated_svd') – str, default is ‘truncated_svd’
function to use to compute the SVD,
seed (Optional[Union[int, Container]], default: None) – Used to create a random seed distribution
when init == ‘random’
mask (Optional[Union[Array, NativeArray, Container]], default: None) – array of booleans with the same shape as tensor should be 0 where
the values are missing and 1 everywhere else. Note: if tensor is
sparse, then mask should also be sparse with a fill value of 1 (or
True).
svd_mask_repeats (Optional[Union[int, Container]], default: 5) – number of iterations for imputing the values in the SVD matrix when
mask is not None
tol (Optional[Union[float, Container]], default: 0.0001) – tolerance: the algorithm stops when the variation in
the reconstruction error is less than the tolerance
verbose (Optional[Union[bool, Container]], default: False) – if True, different in reconstruction errors are returned at each
iteration.
return_errors (Optional[Union[bool, Container]], default: False) – Indicates whether the algorithm should return all reconstruction errors
and computation time of each iteration or not
Default: False
Return type:
Tuple[Container, Sequence[Container]]
Returns:
Container of ivy.TuckerTensors or ivy.TuckerTensors and
container of reconstruction errors if return_errors is True.
ivy.Container static method variant of ivy.hinge_embedding_loss.
This method simplywraps the function, and so the docstring for
ivy.hinge_embedding_loss also applies to this method with minimal
changes.
target (Union[Container, Array, NativeArray]) – input array or container containing the target labels.
margin ([typing.Union[float, ivy.Container]], default: 1.0) – Sets the hyperparameter margin. Determines the necessary input size
for hinge_embedding_loss calculations when label is -1. Inputs smaller
than the margin are minimized with hinge_embedding_loss.
Default is 1.0.
reduction ([typing.Union[str, ivy.Container]], default: 'mean') – Specifies how to aggregate the loss across the batch. Options are:
- 'none': Returns the unreduced loss.
- 'mean': Returns the mean loss.
- 'sum': Returns the summed loss.
Default is 'mean'.
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 input, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is input.
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.
Shape –
----- –
Input: \((*)\) where \(*\) means, any number of dimensions.
The sum operation operates over all the elements.
- Target: \((*)\), same shape as the input
- Output: scalar. If reduction is 'none',
then same shape as the input
Return type:
Container
Returns:
ret – Hinge embedding loss calculated from the input and label,
shaped based on the reduction method.
ivy.Container static method variant of huber_loss. This method
simply wraps the function, and so the docstring for huber_loss also
applies to this method with minimal changes.
pred (Union[Container, Array, NativeArray]) – true array or container containing the predicted labels.
delta (Optional[Union[float, Container]], default: 1.0) – The threshold parameter that determines the point where the loss transitions
from squared error to absolute error. Default is 1.0.
reduction (str, optional) – The type of reduction to apply to the loss.
Possible values are “mean” (default)
and “sum”.
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. It must have a shape
that the true broadcast to.
Return type:
Container
Returns:
ret – The Huber loss between the true and predicted values.
ivy.Container static method variant of ivy.kl_div. This method
simply wraps the function, and so the docstring for ivy.kl_div also
applies to this method with minimal changes.
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 input, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is input.
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. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – The Kullback-Leibler divergence loss between the given distributions.
ivy.Container static method variant of ivy.l1_loss. This method
simply wraps the function, and so the docstring for ivy.l1_loss also
applies to this method with minimal changes.
Parameters:
input (Union[Container, Array, NativeArray]) – input array or container.
target (Union[Container, Array, NativeArray]) – input array or container containing the targeted values.
reduction (Optional[Union[str, Container]], default: 'mean') – 'mean': The output will be averaged.
'sum': The output will be summed.
'none': No reduction will be applied to the output. Default: 'mean'.
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 input, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is input.
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. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – The L1 loss between the input array and the targeted values.
ivy.Container static method variant of ivy.log_poisson_loss. This
method simply wraps the function, and so the docstring for
ivy.log_poisson_loss also applies to this method with minimal changes.
Parameters:
input (Union[Container, Array, NativeArray]) – input array or container.
target (Union[Container, Array, NativeArray]) – input array or container containing the targeted values.
compute_full_loss (bool, default: False) – whether to compute the full loss. If false, a constant term is dropped
in favor of more efficient optimization. Default: False.
axis (int, default: -1) – the axis along which to compute the log-likelihood loss. If axis is -1,
the log-likelihood loss will be computed along the last dimension.
Default: -1.
reduction (Optional[Union[str, Container]], default: 'mean') – 'mean': The output will be averaged.
'sum': The output will be summed.
'none': No reduction will be applied to the output. Default: 'none'.
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 input, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is input.
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. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – The L1 loss between the input array and the targeted values.
ivy.Container static method variant of ivy.poisson_nll_loss. This
method simplywraps the function, and so the docstring for
ivy.poisson_nll_loss also applies to this method with minimal changes.
target (Union[Container, Array, NativeArray]) – input array or container containing the target labels.
log_input ([typing.Union[bool, ivy.Container]], default: True) – If True, the loss is computed as
\(exp(input) - target * input\). If False, the loss is computed as
\(input - target * log(input + eps)\). Default is True.
full ([typing.Union[bool, ivy.Container]], default: False) – Whether to compute the full loss, i.e.,
to add the Stirling approximation term
\(target * log(target) - target + 0.5 * log(2 * pi * target)\).
Default is False.
eps ([typing.Union[float, ivy.Container]], default: 1e-08) – Small value to prevent evaluation of log(0) when log_input is False.
Default is 1e-8.
reduction ([typing.Union[str, ivy.Container]], default: 'mean') – Specifies the reduction applied to the output.
Options are ‘none’, ‘mean’, or ‘sum’.
‘none’: no reduction will be applied. ‘mean’: the output will be averaged.
‘sum’: the output will be summed.
Default is ‘mean’.
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 input, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is input.
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.
Return type:
Container
Returns:
ret – An array of the same shape as input representing
the Poisson Negative Log Likelihood Loss.
Raises:
ValueError – If the input and target tensors do not have the same shape.
ivy.Container static method variant of ivy.smooth_l1_loss. This
method simply wraps the function, and so the docstring for ivy.
smooth_l1_loss also applies to this method with minimal changes.
target (Union[Container, Array, NativeArray]) – input array or container containing the targeticted labels.
beta (Optional[Union[float, Container]], default: 1.0) – a positive float value that sets the smoothness threshold.
Default: 1.0.
reduction (Optional[Union[str, Container]], default: 'mean') – 'none': No reduction will be applied to the output.
'mean': The output will be averaged.
'sum': The output will be summed. Default: 'mean'.
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 input, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is input.
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. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – The smooth L1 loss between the input array and the targeticted labels.
ivy.Container static method variant of ivy.soft_margin_loss. This
method simply wraps the function, and so the docstring for
ivy.soft_margin_loss also applies to this method with minimal changes.
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 input, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is input.
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. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – The soft margin loss between the given distributions.
ivy.Container instance method variant of ivy.hinge_embedding_loss.
This method simply wraps the function, and so the docstring for
ivy.hinge_embedding_loss also applies to this method with minimal
changes.
Parameters:
input – input array or container containing input labels.
target (Union[Container, Array, NativeArray]) – input array or container containing the target labels.
margin ([typing.Union[float, ivy.Container]], default: 1.0) – Sets the hyperparameter margin. Determines the necessary input size
for hinge_embedding_loss calculations when label is -1. Inputs smaller
than the margin are minimized with hinge_embedding_loss.
Default is 1.0.
reduction ([typing.Union[str, ivy.Container]], default: 'mean') – Specifies how to aggregate the loss across the batch. Options are:
- 'none': Returns the unreduced loss.
- 'mean': Returns the mean loss.
- 'sum': Returns the summed loss.
Default is 'mean'.
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 input, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is input.
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.
Shape –
----- –
Input: \((*)\) where \(*\) means, any number of dimensions.
The sum operation operates over all the elements.
- Target: \((*)\), same shape as the input
- Output: scalar. If reduction is 'none',
then same shape as the input
Return type:
Container
Returns:
ret – Hinge embedding loss calculated from the input and label,
shaped based on the reduction method.
ivy.Container instance method variant of huber_loss. This method
simply wraps the function, and so the docstring for huber_loss also
applies to this method with minimal changes.
pred (Union[Container, Array, NativeArray]) – true array or container containing the predicted labels.
delta (Optional[Union[float, Container]], default: 1.0) – The threshold parameter that determines the point where the loss transitions
from squared error to absolute error. Default is 1.0.
reduction (str, optional) – The type of reduction to apply to the loss.
Possible values are “mean” (default)
and “sum”.
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. It must have a shape
that the trues broadcast to.
Return type:
Container
Returns:
ret – The Huber loss between the true and predicted values.
ivy.Container instance method variant of ivy.kl_div. This method
simply wraps the function, and so the docstring for ivy.kl_div also
applies to this method with minimal changes.
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 input, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is input.
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. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – The Kullback-Leibler divergence loss between the given distributions.
ivy.Container instance method variant of ivy.l1_loss. This method
simply wraps the function, and so the docstring for ivy.l1_loss also
applies to this method with minimal changes.
Parameters:
self (Container) – input container.
target (Union[Container, Array, NativeArray]) – input array or container containing the targeticted values.
reduction (Optional[Union[str, Container]], default: 'mean') – 'mean': The output will be averaged.
'sum': The output will be summed.
'none': No reduction will be applied to the output. Default: 'mean'.
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 input, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is input.
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. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – The L1 loss between the input array and the targeticted values.
ivy.Container instance method variant of ivy.log_poisson_loss. This
method simply wraps the function, and so the docstring for
ivy.log_poisson_loss also applies to this method with minimal changes.
Parameters:
self (Container) – input container.
target (Union[Container, Array, NativeArray]) – input array or container containing the targeticted values.
compute_full_loss (bool, default: False) – whether to compute the full loss. If false, a constant term is dropped
in favor of more efficient optimization. Default: False.
axis (int, default: -1) – the axis along which to compute the log-likelihood loss. If axis is -1,
the log-likelihood loss will be computed along the last dimension.
Default: -1.
reduction (Optional[Union[str, Container]], default: 'mean') – 'mean': The output will be averaged.
'sum': The output will be summed.
'none': No reduction will be applied to the output. Default: 'none'.
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 input, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is input.
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. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – The L1 loss between the input array and the targeticted values.
ivy.Container instance method variant of ivy.poisson_nll_loss. This
method simply wraps the function, and so the docstring for ivy.
poisson_nll_loss also applies to this method with minimal changes.
target (Union[Container, Array, NativeArray]) – input array or container containing the target labels.
log_input ([typing.Union[bool, ivy.Container]], default: True) – If True, the loss is computed as
\(exp(input) - target * input\). If False, the loss is computed as
\(input - target * log(input + eps)\). Default is True.
full ([typing.Union[bool, ivy.Container]], default: False) – Whether to compute the full loss, i.e.,
to add the Stirling approximation term
\(target * log(target) - target + 0.5 * log(2 * pi * target)\).
Default is False.
eps ([typing.Union[float, ivy.Container]], default: 1e-08) – Small value to prevent evaluation of log(0) when log_input is False.
Default is 1e-8.
reduction ([typing.Union[str, ivy.Container]], default: 'mean') – Specifies the reduction applied to the output.
Options are ‘none’, ‘mean’, or ‘sum’.
‘none’: no reduction will be applied. ‘mean’: the output will be averaged.
‘sum’: the output will be summed.
Default is ‘mean’.
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 input, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is input.
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.
Return type:
Container
Returns:
ret – An array of the same shape as input representing
the Poisson Negative Log Likelihood Loss.
Raises:
ValueError – If the input and target tensors do not have the same shape.
ivy.Container instance method variant of ivy.smooth_l1_loss. This
method simply wraps the function, and so the docstring for ivy.
smooth_l1_loss also applies to this method with minimal changes.
target (Union[Container, Array, NativeArray]) – input array or container containing the targeticted labels.
beta (Optional[Union[float, Container]], default: 1.0) – a positive float value that sets the smoothness threshold.
Default: 1.0.
reduction (Optional[Union[str, Container]], default: 'mean') – 'none': No reduction will be applied to the output.
'mean': The output will be averaged.
'sum': The output will be summed. Default: 'mean'.
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 input, the method will be applied to key_chains, otherwise
key_chains
will be skipped. Default is input.
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.
It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – The smooth L1 loss between the input array and the targeticted labels.
ivy.Container instance method variant of ivy.soft_margin_loss. This
method simply wraps the function, and so the docstring for
ivy.soft_margin_loss also applies to this method with minimal changes.
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 input, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is input.
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. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – The soft margin loss between the given distributions.
This method simply wraps the function, and so the docstring for
ivy.take also applies to this method with minimal changes.
Parameters:
x (Union[int, Array, NativeArray, Container]) – input array
indices (Union[int, Array, NativeArray, Container]) – array indices. Must have an integer data type.
axis (Optional[Union[int, Container]], default: None) – axis over which to select values. If axis is negative,
the function must determine the axis along which to select values
by counting from the last dimension.
By default, the flattened input array is used.
mode (Union[str, Container], default: 'fill') – specifies how out-of-bounds indices will behave.
- ‘raise’ – raise an error
- ‘wrap’ – wrap around
- ‘clip’ – clip to the range (all indices that are too large are
replaced by the index that addresses the last element along that axis.
Note that this disables indexing with negative numbers.)
- ‘fill’ (default) = returns invalid values (e.g. NaN)
for out-of bounds indices (see also fill_value below)
fill_value (Optional[Union[Number, Container]], default: None) – fill value to return for out-of-bounds slices
(Defaults to NaN for inexact types,
the largest negative value for signed types,
the largest positive value for unsigned types, and True for booleans.)
out (Optional[Union[Array, Container]], default: None) – optional output array, for writing the result to. It must
have a shape that the inputs broadcast to.
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.
Return type:
Container
Returns:
ret
an array having the same data type as x.
The output array must have the same rank
(i.e., number of dimensions) as x and
must have the same shape as x,
except for the axis specified by axis
whose size must equal the number of elements in indices.
ivy.Container static method variant of ivy.trim_zeros. This method
simply wraps the function, and so the docstring for ivy.trim_zeros also
applies to this method with minimal changes.
Parameters:
self (1-D array) – Input array.
trim (str, optional) – A string with ‘f’ representing trim from front and ‘b’ to trim from
back. Default is ‘fb’, trim zeros from both front and back of the
array.
Return type:
Container
Returns:
1-D array
The result of trimming the input. The input data type is preserved.
ivy.Container static method variant of ivy.unflatten. This method
simply wraps the function, and so the docstring for ivy.unflatten also
applies to this method with minimal changes.
Parameters:
x (Union[int, Array, NativeArray, Container]) – input array
shape (Union[Tuple[int], Array, NativeArray, Container]) – array indices. Must have an integer data type.
dim (Optional[Union[int, Container]], default: 0) – axis over which to select values. If axis is negative,
the function must determine the axis along which to select values
by counting from the last dimension.
By default, the flattened input array is used.
out (Optional[Union[Array, Container]], default: None) – optional output array, for writing the result to. It must
have a shape that the inputs broadcast to.
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.
Return type:
Container
Returns:
ret
an array having the same data type as x.
The output array must have the same rank
(i.e., number of dimensions) as x and
must have the same shape as x,
except for the axis specified by axis
whose size must equal the number of elements in indices.
ivy.Container instance method variant of ivy.as_strided. This method
simply wraps the function, and so the docstring for ivy.as_strided also
applies to this method with minimal changes.
ivy.Container instance method variant of ivy.associative_scan. This
method simply wraps the function, and so the docstring for
ivy.associative_scan also applies to this method with minimal changes.
Parameters:
self (Union[Array, NativeArray, Container]) – The Container to scan over.
fn (Union[Callable, Container]) – The associative function to apply.
reverse (Union[bool, Container], default: False) – Whether to scan in reverse with respect to the given axis.
axis (Union[int, Container], default: 0) – The axis to scan over.
ivy.Container instance method variant of ivy.atleast_1d. This method
simply wraps the function, and so the docstring for ivy.atleast_1d also
applies to this method with minimal changes.
Parameters:
self (Union[Container, Array, NativeArray]) – the container with array inputs.
arys (Union[Container, Array, NativeArray, bool, Number]) – one or more container with array inputs.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether or not to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The keychains 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.
Return type:
List[Container]
Returns:
ret – container or list of container where each elements within container is
at least 1d. Copies are made only if necessary.
ivy.Container instance method variant of ivy.atleast_2d. This method
simply wraps the function, and so the docstring for ivy.atleast_2d also
applies to this method with minimal changes.
Parameters:
self (Union[Container, Array, NativeArray]) – container with array inputs.
arys (Union[Container, Array, NativeArray]) – one or more container with array inputs.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether or not to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The keychains 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.
Return type:
List[Container]
Returns:
ret – container or list of container where each elements within container is
at least 2D. Copies are made only if necessary.
ivy.Container instance method variant of ivy.atleast_3d. This method
simply wraps the function, and so the docstring for ivy.atleast_3d also
applies to this method with minimal changes.
Parameters:
self (Union[Container, Array, NativeArray]) – container with array inputs.
arys (Union[Container, Array, NativeArray, bool, Number]) – one or more container with array inputs.
key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The keychains 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.
Return type:
List[Container]
Returns:
ret – container or list of container where each elements within container is
at least 3D. Copies are made only if necessary. For example, a 1-D array
of shape (N,) becomes a view of shape (1, N, 1), and a 2-D array of shape
(M, N) becomes a view of shape (M, N, 1).
ivy.Container instance method variant of ivy.broadcast_shapes. This
method simply wraps the function, and so the docstring for
ivy.broadcast_shapes also applies to this method with minimal changes.
Parameters:
self (Container) – the container with shapes to broadcast.
ivy.Container instance method variant of ivy.column_stack.
This method simply wraps the function, and so the docstring for
ivy.column_stack also applies to this method with minimal
changes.
Parameters:
self (Container) – Container with leaves to stack with leaves of other arrays/containers.
xs (Sequence[Union[Container, Array, NativeArray]]) – Container with other leaves to join.
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 array, for writing the result to.
ivy.Container instance method variant of ivy.stack. This method
simply wraps the function, and so the docstring for ivy.stack also
applies to this method with minimal changes.
Parameters:
self (Container) –
Container with leaves to join with leaves of other arrays/containers.
Each array leave must have the same shape.
input_sequence (Union[Tuple[Union[Array, NativeArray, Container]], List[Union[Array, NativeArray, Container]]]) – Container with other leaves to join.
Each array leave must have the same shape.
new_axis (Union[int, Container], default: 0) – Insert and concatenate on a new axis or not,
default 0 means do not insert new axis.
new_axis = 0: concatenate
new_axis = 1: stack
axis (Union[int, Container], default: 0) – axis along which the array leaves will be concatenated. More details can
be found in the docstring for ivy.stack.
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 array, for writing the result to. It must have a shape
that the inputs broadcast to.
ivy.Container instance method variant of ivy.dsplit. This method
simply wraps the function, and so the docstring for ivy.dsplit also
applies to this method with minimal changes.
Parameters:
self (Container) – the container with array inputs.
indices_or_sections (Union[int, Sequence[int], Array, NativeArray, Container]) – If indices_or_sections is an integer n, the array is split into n
equal sections, provided that n must be a divisor of the split axis.
If indices_or_sections is a sequence of ints or 1-D array,
then input is split at each of the indices.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether or not to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
Return type:
List[Container]
Returns:
ret – list of containers holding arrays split from the input at the 3rd axis
ivy.Container instance method variant of ivy.stack. This method
simply wraps the function, and so the docstring for ivy.stack also
applies to this method with minimal changes.
shape (Union[Shape, NativeShape, Container]) – A 1-D Array indicates the shape you want to expand to,
following the broadcast rule.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
device
out (Optional[Container], default: None) – optional output array, for writing the result to. It must have a shape
that the inputs broadcast to.
ivy.Container instance method variant of ivy.flatten. This method
simply wraps the function, and so the docstring for ivy.flatten also
applies to this method with minimal changes.
Parameters:
self (Container) – input container to flatten at leaves.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether or not to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
start_dim (Union[int, Container], default: 0) – first dim to flatten. If not set, defaults to 0.
end_dim (Union[int, Container], default: -1) – last dim to flatten. If not set, defaults to -1.
order (Union[str, Container], default: 'C') – Read the elements of the input container using this index order,
and place the elements into the reshaped array using this index order.
‘C’ means to read / write the elements using C-like index order,
with the last axis index changing fastest, back to the first axis index
changing slowest.
‘F’ means to read / write the elements using Fortran-like index order, with
the first index changing fastest, and the last index changing slowest.
Note that the ‘C’ and ‘F’ options take no account of the memory layout
of the underlying array, and only refer to the order of indexing.
Default order is ‘C’
ivy.Container instance method variant of ivy.fliplr. This method
simply wraps the function, and so the docstring for ivy.fliplr also
applies to this method with minimal changes.
Parameters:
self (Container) – the container with arrays to be flipped. Arrays must be at least 2-D.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether or not to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
out (Optional[Container], default: None) – optional output container, for writing the result to.
Return type:
Container
Returns:
ret – container including arrays corresponding to the input container’s array
with elements order reversed along axis 1.
ivy.Container instance method variant of ivy.flipud. This method
simply wraps the function, and so the docstring for ivy.flipud also
applies to this method with minimal changes.
Parameters:
self (Container) – the container with arrays to be flipped.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether or not to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
out (Optional[Container], default: None) – optional output container, for writing the result to.
Return type:
Container
Returns:
ret – container including arrays corresponding to the input container’s array
with elements order reversed along axis 0.
ivy.Container instance method variant of ivy.heaviside. This method
simply wraps the function, and so the docstring for ivy.heaviside also
applies to this method with minimal changes.
Parameters:
self (Container) – input container including the arrays.
x2 (Container) – values to use where the array is zero.
out (Optional[Container], default: None) – optional output container array, for writing the result to.
Return type:
Container
Returns:
ret – output container with element-wise Heaviside step function of each array.
ivy.Container instance method variant of ivy.hsplit. This method
simply wraps the function, and so the docstring for ivy.hsplit also
applies to this method with minimal changes.
Parameters:
self (Container) – the container with array inputs.
indices_or_sections (Union[int, Sequence[int], Array, NativeArray, Container]) – If indices_or_sections is an integer n, the array is split into n
equal sections, provided that n must be a divisor of the split axis.
If indices_or_sections is a sequence of ints or 1-D array,
then input is split at each of the indices.
Return type:
List[Container]
Returns:
ret – list of containers split horizontally from input container
ivy.Container instance method variant of ivy.hstack. This method
simply wraps the function, and so the docstring for ivy.hstack also
applies to this method with minimal changes.
ivy.Container instance method variant of ivy.i0. This method simply
wraps the function, and so the docstring for ivy.i0 also applies to
this method with minimal changes.
Parameters:
self (Container) – the container with array inputs.
out (Optional[Container], default: None) – optional output container, for writing the result to.
Return type:
Container
Returns:
ret – container including arrays with the modified Bessel
function evaluated at each of the elements of x.
ivy.Container instance method variant of ivy.matricize.
This method simply wraps the function, and so the docstring for
ivy.matricize also applies to this method with minimal
changes.
Parameters:
self (Union[Array, NativeArray, Container]) – the input tensor
row_modes (Union[Sequence[int], Container]) – modes to use as row of the matrix (in the desired order)
column_modes (Optional[Union[Sequence[int], Container]], default: None) – modes to use as column of the matrix, in the desired order
if None, the modes not in row_modes will be used in ascending order
out (Optional[Container], default: None) – optional output array, for writing the result to.
ivy.Container instance method variant of ivy.moveaxis. This method
simply wraps the function, and so the docstring for ivy.flatten also
applies to this method with minimal changes.
Parameters:
self (Container) – The container with the arrays whose axes should be reordered.
source (Union[int, Sequence[int], Container]) – Original positions of the axes to move. These must be unique.
destination (Union[int, Sequence[int], Container]) – Destination positions for each of the original axes.
These must also be unique.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether or not to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
out (Optional[Container], default: None) – optional output container, for writing the result to.
Return type:
Container
Returns:
ret – Container including arrays with moved axes.
Examples
With one ivy.Container input:
>>> x = ivy.Container(a=ivy.zeros((3, 4, 5)), b=ivy.zeros((2,7,6)))
>>> x.moveaxis(, 0, -1).shape
{
ivy.Container static method variant of ivy.rot90. This method simply
wraps the function, and so the docstring for ivy.rot90 also applies to
this method with minimal changes.
Parameters:
self (Union[Container, Array, NativeArray]) – Input array of two or more dimensions.
k (Union[int, Container], default: 1) – Number of times the array is rotated by 90 degrees.
axes (Union[Tuple[int, int], Container], default: (0,1)) – The array is rotated in the plane defined by the axes. Axes must be
different.
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. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – Container with a rotated view of input array.
ivy.Container instance method variant of ivy.soft_thresholding.
This method simply wraps the function, and so the docstring for
ivy.soft_thresholding also applies to this method with minimal
changes.
Parameters:
x – the input tensor
threshold (Union[float, Array, NativeArray, Container]) – float or array with shape tensor.shape
* If float the threshold is applied to the whole tensor
* If array, one threshold is applied per elements, 0 values are ignored
out (Optional[Container], default: None) – optional output array, for writing the result to.
Return type:
Container
Returns:
ivy.Container – thresholded tensor on which the operator has been applied
ivy.Container instance method variant of ivy.as_strided. This method
simply wraps the function, and so the docstring for ivy.as_strided also
applies to this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – Input container.
shape (Union[Shape, NativeShape, Sequence[int], Container]) – The shape of the new arrays.
strides (Union[Sequence[int], Container]) – The strides of the new arrays (specified in bytes).
key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The keychains 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.
ivy.Container static method variant of ivy.atleast_1d. This method
simply wraps the function, and so the docstring for ivy.atleast_1d also
applies to this method with minimal changes.
Parameters:
arys (Union[Array, NativeArray, Container]) – one or more container with array inputs.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether or not to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The keychains 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.
Return type:
List[Container]
Returns:
ret – container or list of container where each elements within container is
at least 1d. Copies are made only if necessary.
ivy.Container static method variant of ivy.atleast_2d. This method
simply wraps the function, and so the docstring for ivy.atleast_2d also
applies to this method with minimal changes.
Parameters:
arys (Union[Array, NativeArray, Container]) – one or more container with array inputs.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether or not to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The keychains 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.
Return type:
List[Container]
Returns:
ret – container or list of container where each elements within container is
at least 2D. Copies are made only if necessary.
ivy.Container static method variant of ivy.atleast_3d. This method
simply wraps the function, and so the docstring for ivy.atleast_3d also
applies to this method with minimal changes.
Parameters:
arys (Union[Array, NativeArray, Container]) – one or more container with array inputs.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether or not to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The keychains 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.
Return type:
List[Container]
Returns:
ret – container or list of container where each elements within container is
at least 3D. Copies are made only if necessary. For example, a 1-D array
of shape (N,) becomes a view of shape (1, N, 1), and a 2-D array of shape
(M, N) becomes a view of shape (M, N, 1).
ivy.Container static method variant of ivy.broadcast_shapes. This
method simply wraps the function, and so the docstring for ivy.hsplit
also applies to this method with minimal changes.
Parameters:
shapes (Union[Container, List[Tuple[int]]]) – the container with shapes to broadcast.
key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The keychains 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.
ivy.Container static method variant of ivy.column_stack.
This method simply wraps the function, and so the docstring for
ivy.column_stack also applies to this method with minimal
changes.
Parameters:
xs (Sequence[Union[Container, Array, NativeArray]]) – Container with leaves to stack.
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 array, for writing the result to.
ivy.Container static method variant of ivy.concat_from_sequence.
This method simply wraps the function, and so the docstring for
ivy.concat_from_sequence also applies to this method with minimal
changes.
Parameters:
input_sequence (Union[Tuple[Union[Array, NativeArray, Container]], List[Union[Array, NativeArray, Container]]]) – Container with leaves to join. Each array leave must have the same shape.
new_axis (Union[int, Container], default: 0) – Insert and concatenate on a new axis or not,
default 0 means do not insert new axis.
new_axis = 0: concatenate
new_axis = 1: stack
axis (Union[int, Container], default: 0) – axis along which the array leaves will be concatenated. More details
can be found in the docstring for ivy.concat_from_sequence.
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 array, for writing the result to. It must have a shape
that the inputs broadcast to.
ivy.Container static method variant of ivy.dsplit. This method
simply wraps the function, and so the docstring for ivy.dsplit also
applies to this method with minimal changes.
Parameters:
ary (Union[Array, NativeArray, Container]) – the container with array inputs.
indices_or_sections (Union[int, Sequence[int], Array, NativeArray, Container]) – If indices_or_sections is an integer n, the array is split into n
equal sections, provided that n must be a divisor of the split axis.
If indices_or_sections is a sequence of ints or 1-D array,
then input is split at each of the indices.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether or not to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
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.
Return type:
List[Container]
Returns:
ret – list of containers holding arrays split from the input at the 3rd axis
ivy.Container static method variant of ivy.stack. This method simply
wraps the function, and so the docstring for ivy.dstack also applies to
this method with minimal changes.
Return type:
Container
Examples
With one ivy.Container input:
>>> c = ivy.Container(a=[ivy.array([1,2,3]), ivy.array([0,0,0])],
x (Union[Array, NativeArray, Container]) – input container.
shape (Union[Shape, NativeShape, Container]) – A 1-D Array indicates the shape you want to expand to,
following the broadcast rule.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
device
key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The keychains 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 array, for writing the result to. It must have a shape
that the inputs broadcast to.
ivy.Container static method variant of ivy.flatten. This method
simply wraps the function, and so the docstring for ivy.flatten also
applies to this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – input container to flatten at leaves.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether or not to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
start_dim (Union[int, Container], default: 0) – first dim to flatten. If not set, defaults to 0.
end_dim (Union[int, Container], default: -1) – last dim to flatten. If not set, defaults to -1.
order (Union[str, Container], default: 'C') – Read the elements of the input container using this index order,
and place the elements into the reshaped array using this index order.
‘C’ means to read / write the elements using C-like index order,
with the last axis index changing fastest, back to the first axis index
changing slowest.
‘F’ means to read / write the elements using Fortran-like index order, with
the first index changing fastest, and the last index changing slowest.
Note that the ‘C’ and ‘F’ options take no account of the memory layout
of the underlying array, and only refer to the order of indexing.
Default order is ‘C’
ivy.Container static method variant of ivy.fliplr. This method
simply wraps the function, and so the docstring for ivy.fliplr also
applies to this method with minimal changes.
Parameters:
m (Union[Array, NativeArray, Container]) – the container with arrays to be flipped. Arrays must be at least 2-D.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether or not to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
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 arrays corresponding to the input container’s array
with elements order reversed along axis 1.
Examples
With one ivy.Container input:
>>> m = ivy.Container(a=ivy.diag([1, 2, 3]), … b=ivy.array([[1, 2, 3],[4, 5, 6]]))
>>> ivy.Container.static_fliplr(m)
{
ivy.Container static method variant of ivy.flipud. This method
simply wraps the function, and so the docstring for ivy.flipud also
applies to this method with minimal changes.
Parameters:
m (Union[Array, NativeArray, Container]) – the container with arrays to be flipped.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether or not to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
out (Optional[Container], default: None) – optional output container, for writing the result to.
Return type:
Container
Returns:
ret – container including arrays corresponding to the input container’s array
with elements order reversed along axis 0.
ivy.Container static method variant of ivy.heaviside. This method
simply wraps the function, and so the docstring for ivy.heaviside also
applies to this method with minimal changes.
Parameters:
x1 (Union[Array, NativeArray, Container]) – input container including the arrays.
x2 (Union[Array, NativeArray, Container]) – values to use where the array is zero.
out (Optional[Container], default: None) – optional output container array, for writing the result to.
Return type:
Container
Returns:
ret – output container with element-wise Heaviside step function of each array.
ivy.Container static method variant of ivy.hsplit. This method
simply wraps the function, and so the docstring for ivy.hsplit also
applies to this method with minimal changes.
Parameters:
ary (Union[Array, NativeArray, Container]) – the container with array inputs.
indices_or_sections (Union[int, Sequence[int], Array, NativeArray, Container]) – If indices_or_sections is an integer n, the array is split into n
equal sections, provided that n must be a divisor of the split axis.
If indices_or_sections is a sequence of ints or 1-D array,
then input is split at each of the indices.
key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The keychains 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.
Return type:
List[Container]
Returns:
ret – list of containers split horizontally from input array.
ivy.Container static method variant of ivy.hstack. This method
simply wraps the function, and so the docstring for ivy.hstack also
applies to this method with minimal changes.
Return type:
Container
Examples
With one ivy.Container input:
>>> c = ivy.Container(a=[ivy.array([1,2,3]), ivy.array([0,0,0])])
>>> ivy.Container.static_hstack(c)
{
ivy.Container static method variant of ivy.i0. This method simply
wraps the function, and so the docstring for ivy.i0 also applies to
this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – the container with array inputs.
out (Optional[Container], default: None) – optional output container, for writing the result to.
Return type:
Container
Returns:
ret – container including arrays with the modified Bessel
function evaluated at each of the elements of x.
ivy.Container static method variant of ivy.matricize.
This method simply wraps the function, and so the docstring for
ivy.matricize also applies to this method with minimal
changes.
Parameters:
x (Union[Array, NativeArray, Container]) – the input tensor
row_modes (Union[Sequence[int], Container]) – modes to use as row of the matrix (in the desired order)
column_modes (Optional[Union[Sequence[int], Container]], default: None) – modes to use as column of the matrix, in the desired order
if None, the modes not in row_modes will be used in ascending order
out (Optional[Container], default: None) – optional output array, for writing the result to.
ivy.Container static method variant of ivy.moveaxis. This method
simply wraps the function, and so the docstring for ivy.moveaxis also
applies to this method with minimal changes.
Parameters:
a (Union[Array, NativeArray, Container]) – The container with the arrays whose axes should be reordered.
source (Union[int, Sequence[int], Container]) – Original positions of the axes to move. These must be unique.
destination (Union[int, Sequence[int], Container]) – Destination positions for each of the original axes.
These must also be unique.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether or not to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
out (Optional[Container], default: None) – optional output container, for writing the result to.
Return type:
Container
Returns:
ret – Container including arrays with moved axes.
Examples
With one ivy.Container input:
>>> x = ivy.Container(a=ivy.zeros((3, 4, 5)), b=ivy.zeros((2,7,6)))
>>> ivy.Container.static_moveaxis(x, 0, -1).shape
{
ivy.Container static method variant of ivy.rot90. This method simply
wraps the function, and so the docstring for ivy.rot90 also applies to
this method with minimal changes.
Parameters:
m (Union[Container, Array, NativeArray]) – Input array of two or more dimensions.
k (Union[int, Container], default: 1) – Number of times the array is rotated by 90 degrees.
axes (Union[Tuple[int, int], Container], default: (0,1)) – The array is rotated in the plane defined by the axes. Axes must be
different.
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. It must have a shape
that the inputs broadcast to.
ivy.Container static method variant of ivy.soft_thresholding.
This method simply wraps the function, and so the docstring for
ivy.soft_thresholding also applies to this method with minimal
changes.
Parameters:
x (Union[Array, NativeArray, Container]) – the input tensor
threshold (Union[float, Array, NativeArray, Container]) – float or array with shape tensor.shape
* If float the threshold is applied to the whole tensor
* If array, one threshold is applied per elements, 0 values are ignored
out (Optional[Container], default: None) – optional output array, for writing the result to.
Return type:
Container
Returns:
ivy.Container – thresholded tensor on which the operator has been applied
ivy.Container static method variant of ivy.take_along_axis. This
method simply wraps the function, and so the docstring for
ivy.take_along_axis also applies to this method with minimal changes.
Parameters:
arr (Union[Array, NativeArray, Container]) – container with array inputs.
indices (Union[Array, NativeArray, Container]) – container with indices of the values to extract.
axis (Union[int, Container]) – The axis over which to select values. If axis is None, then arr and indices
must be 1-D sequences of the same length.
mode (Union[str, Container], default: 'fill') – One of: ‘clip’, ‘fill’, ‘drop’. Parameter controlling how out-of-bounds
indices will be handled.
key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The keychains 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 – a container with arrays of the same shape as those in indices.
ivy.Container static method variant of ivy.top_k. This method simply
wraps the function, and so the docstring for ivy.top_k also applies to
this method with minimal changes.
Parameters:
x (Union[Container, Array, NativeArray]) – The container to compute top_k for.
k (Union[int, Container]) – Number of top elements to return must not exceed the array size.
axis (Union[int, Container], default: -1) – The axis along which we must return the top elements default value is 1.
largest (Union[bool, Container], default: True) – If largest is set to False we return k smallest elements of the array.
sorted (Union[bool, Container], default: True) – If sorted is set to True we return the elements in sorted order.
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[Union[Tuple[Container, Container], Container]], default: None) – Optional output tuple, for writing the result to. Must have two Container,
with a shape that the returned tuple broadcast to.
ivy.Container static method variant of ivy.vsplit. This method
simply wraps the function, and so the docstring for ivy.vsplit also
applies to this method with minimal changes.
Parameters:
ary (Union[Array, NativeArray, Container]) – the container with array inputs.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether or not to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
indices_or_sections (Union[int, Sequence[int], Array, NativeArray, Container]) – If indices_or_sections is an integer n, the array is split into n
equal sections, provided that n must be a divisor of the split axis.
If indices_or_sections is a sequence of ints or 1-D array,
then input is split at each of the indices.
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.
Return type:
List[Container]
Returns:
ret – list of containers holding arrays split vertically from the input
ivy.Container static method variant of ivy.stack. This method simply
wraps the function, and so the docstring for ivy.vstack also applies to
this method with minimal changes.
indices (Union[int, Array, NativeArray, Container]) – array indices. Must have an integer data type.
axis (Optional[Union[int, Container]], default: None) – axis over which to select values. If axis is negative,
the function must determine the axis along which to select values
by counting from the last dimension.
By default, the flattened input array is used.
mode (Union[str, Container], default: 'fill') – specifies how out-of-bounds indices will behave.
- ‘raise’ – raise an error
- ‘wrap’ – wrap around
- ‘clip’ – clip to the range (all indices that are too large are
replaced by the index that addresses the last element along that axis.
Note that this disables indexing with negative numbers.)
- ‘fill’ (default) = returns invalid values (e.g. NaN)
for out-of bounds indices (see also fill_value below)
fill_value (Optional[Union[Number, Container]], default: None) – fill value to return for out-of-bounds slices
(Defaults to NaN for inexact types,
the largest negative value for signed types,
the largest positive value for unsigned types, and True for booleans.)
out (Optional[Union[Array, Container]], default: None) – optional output array, for writing the result to. It must
have a shape that the inputs broadcast to.
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.
Return type:
Container
Returns:
ret
an array having the same data type as x.
The output array must have the same rank
(i.e., number of dimensions) as x and
must have the same shape as x,
except for the axis specified by axis
whose size must equal the number of elements in indices.
ivy.Container instance method variant of ivy.take_along_axis. This
method simply wraps the function, and so the docstring for
ivy.take_along_axis also applies to this method with minimal changes.
Parameters:
self (Union[Container, Array, NativeArray]) – container with array inputs.
indices (Union[Container, Array, NativeArray]) – container with indices of the values to extract.
axis (Union[int, Container]) – The axis over which to select values. If axis is None, then arr and indices
must be 1-D sequences of the same length.
mode (Union[str, Container], default: 'fill') – One of: ‘clip’, ‘fill’, ‘drop’. Parameter controlling how out-of-bounds
indices will be handled.
key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The keychains 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 – a container with arrays of the same shape as those in indices.
ivy.Container instance method variant of ivy.top_k. This method
simply wraps the function, and so the docstring for ivy.top_k also
applies to this method with minimal changes.
Parameters:
self (Container) – The container to compute top_k for.
k (Union[int, Container]) – Number of top elements to return must not exceed the array size.
axis (Union[int, Container], default: -1) – The axis along which we must return the top elements default value is 1.
largest (Union[bool, Container], default: True) – If largest is set to False we return k smallest elements of the array.
sorted (Union[bool, Container], default: True) – If sorted is set to True we return the elements in sorted order.
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[Tuple[Container, Container]], default: None) – Optional output tuple, for writing the result to. Must have two Container,
with a shape that the returned tuple broadcast to.
ivy.Container instance method variant of ivy.trim_zeros. This method
simply wraps the function, and so the docstring for ivy.trim_zeros also
applies to this method with minimal changes.
Parameters:
self (1-D array) – Input array.
trim (str, optional) – A string with ‘f’ representing trim from front and ‘b’ to trim from
back. Default is ‘fb’, trim zeros from both front and back of the
array.
Return type:
Array
Returns:
1-D array
The result of trimming the input. The input data type is preserved.
ivy.Container instance method variant of ivy.unflatten. This method
simply wraps the function, and so the docstring for ivy.unflatten also
applies to this method with minimal changes.
Parameters:
self (Container) – input array
shape (Union[Tuple[int], Array, NativeArray, Container]) – array indices. Must have an integer data type.
dim (Optional[Union[int, Container]], default: 0) – axis over which to unflatten. If axis is negative,
the function must determine the axis along which to select values
by counting from the last dimension.
By default, the flattened input array is used.
out (Optional[Union[Array, Container]], default: None) – optional output array, for writing the result to. It must
have a shape that the inputs broadcast to.
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.
Return type:
Container
Returns:
ret
an array having the same data type as x.
The output array must have the same rank
(i.e., number of dimensions) as x and
must have the same shape as x,
except for the axis specified by dim
which is replaced with a tuple specified in shape.
ivy.Container instance method variant of ivy.vsplit. This method
simply wraps the function, and so the docstring for ivy.vsplit also
applies to this method with minimal changes.
Parameters:
self (Container) – the container with array inputs.
copy (Optional[Union[bool, Container]], default: None) – boolean indicating whether or not to copy the input array.
If True, the function must always copy.
If False, the function must never copy and must
raise a ValueError in case a copy would be necessary.
If None, the function must reuse existing memory buffer if possible
and copy otherwise. Default: None.
indices_or_sections (Union[int, Sequence[int], Array, NativeArray, Container]) – If indices_or_sections is an integer n, the array is split into n
equal sections, provided that n must be a divisor of the split axis.
If indices_or_sections is a sequence of ints or 1-D array,
then input is split at each of the indices.
Return type:
List[Container]
Returns:
ret – list of containers holding arrays split vertically from the input
ivy.Container instance method variant of ivy.stack. This method
simply wraps the function, and so the docstring for ivy.stack also
applies to this method with minimal changes.
ivy.Container instance method variant of ivy.stack. This method simply
wraps the function, and so the docstring for ivy.stack also applies to this
method with minimal changes.
Parameters:
self (Container) –
arrays/containers. (Container with leaves to join with leaves of other) –
:param :
:param default 0 means do not insert new axis.:
:param new_axis = 0:
:type new_axis = 0: concatenate
:param new_axis = 1:
:type new_axis = 1: stack
:type axis: Union[int, Container], default: 0
:param axis:
:param axis along which the array leaves will be concatenated. More details can be found in:
:param the docstring for ivy.stack.:
:type key_chains: Optional[Union[List[str], Dict[str, str], Container]], default: None
:param key_chains:
:param The key-chains to apply or not apply the method to. Default is None.:
:type to_apply: Union[bool, Container], default: True
:param to_apply:
:param If True:
:param the method will be applied to key_chains:
:param otherwise key_chains:
:param will be skipped. Default is True.:
:type prune_unapplied: Union[bool, Container], default: False
:param prune_unapplied:
:param Whether to prune key_chains for which the function was not applied.:
:param Default is False.:
:type map_sequences: Union[bool, Container], default: False
:param map_sequences:
:param Whether to also map method to sequences (lists:
:param tuples).:
:param Default is False.:
:type out: Optional[Container], default: None
:param out:
:param optional output array:
:param for writing the result to. It must have a shape:
:param that the inputs broadcast to.:
ivy.Container instance method variant of ivy.batch_norm. This method
simply wraps the function, and so the docstring for ivy.batch_norm also
applies to this method with minimal changes.
Parameters:
x –
Input array of default shape (N, *S, C), where N is the batch dimension,
*S corresponds to any number of spatial dimensions and
C corresponds to the channel dimension.
mean (Optional[Union[Array, NativeArray, Container]]) – Mean array used for input’s normalization. It can be of any shape
braodcastable to (N,*S,C).
variance (Optional[Union[Array, NativeArray, Container]]) – Variance array used for input’s normalization. It can be of any shape
braodcastable to (N,*S,C).
offset (Optional[Union[Array, NativeArray, Container]], default: None) – An offset array. If present, will be added to the normalized input.
It can be of any shape broadcastable to (N,*S,C).
scale (Optional[Union[Array, NativeArray, Container]], default: None) – A scale array. If present, the scale is applied to the normalized input.
It can be of any shape broadcastable to (N,*S,C).
training (Union[bool, Container], default: False) – If true, calculate and use the mean and variance of x. Otherwise, use the
provided mean and variance.
eps (Union[float, Container], default: 1e-05) – A small float number to avoid dividing by 0.
the value used for the running_mean and running_var computation.
Default value is 0.1.
data_format (Union[str, Container], default: 'NSC') – The ordering of the dimensions in the input, one of “NSC” or “NCS”,
where N is the batch dimension, S represents any number of spatial
dimensions and C is the channel dimension. Default is “NSC”.
out (Optional[Tuple[Union[Array, Container], Union[Array, Container], Union[Array, Container]]], default: None) – optional output arrays, for writing the result to.
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.
Return type:
Tuple[Container, Container, Container]
Returns:
ret –
Tuple of containers containing
the normalized input, running mean, and running variance.
ivy.Container static method variant of ivy.group_norm. This method
simply wraps the function, and so the docstring for ivy.group_norm also
applies to this method with minimal changes.
Parameters:
self (Union[Array, NativeArray, Container]) – Input array of default shape (N, *S, C), where N is the batch dimension,
*S corresponds to any number of spatial dimensions and
C corresponds to the channel dimension.
num_groups (Union[int, Container], default: 1) – number of groups to separate the channels into
offset (Optional[Union[Array, NativeArray, Container]], default: None) – An offset array of size C. If present, will be added
to the normalized input.
scale (Optional[Union[Array, NativeArray, Container]], default: None) – A scale array of size C. If present, the scale is
applied to the normalized input.
eps (Union[float, Container], default: 1e-05) – A small float number to avoid dividing by 0.
data_format (Union[str, Container], default: 'NSC') – The ordering of the dimensions in the input, one of “NSC” or “NCS”,
where N is the batch dimension, S represents any number of spatial
dimensions and C is the channel dimension. Default is “NSC”.
out (Optional[Union[Array, Container]], default: None) – optional output arrays, for writing the result to.
ivy.Container instance method variant of ivy.instance_norm. This
method simply wraps the function, and so the docstring for
ivy.instance_norm also applies to this method with minimal changes.
Parameters:
self (Union[Array, NativeArray, Container]) –
Input array of shape default (N, *S, C), where N is the batch dimension,
*S corresponds to any number of spatial dimensions and
C corresponds to the channel dimension.
mean (Optional[Union[Array, NativeArray, Container]]) – Mean array of size C used for input’s normalization.
variance (Optional[Union[Array, NativeArray, Container]]) – Variance array of size C used for input’s normalization.
offset (Optional[Union[Array, NativeArray, Container]], default: None) – An offset array of size C. If present, will be added
to the normalized input.
scale (Optional[Union[Array, NativeArray, Container]], default: None) – A scale array of size C. If present, the scale is
applied to the normalized input.
training (Union[bool, Container], default: False) – If true, calculate and use the mean and variance of x. Otherwise, use the
provided mean and variance.
eps (Union[float, Container], default: 1e-05) – A small float number to avoid dividing by 0.
the value used for the running_mean and running_var computation.
Default value is 0.1.
data_format (Union[str, Container], default: 'NSC') – The ordering of the dimensions in the input, one of “NSC” or “NCS”,
where N is the batch dimension, S represents any number of spatial
dimensions and C is the channel dimension. Default is “NSC”.
out (Optional[Tuple[Union[Array, Container], Union[Array, Container], Union[Array, Container]]], default: None) – optional output arrays, for writing the result to.
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.
Return type:
Tuple[Container, Container, Container]
Returns:
ret –
Tuple of containers containing
the normalized input, running mean, and running variance.
ivy.Container instance method variant of ivy.l1_normalize. This
method simply wraps the function, and so the docstring for
ivy.l1_normalize also applies to this method with minimal changes.
Parameters:
self (Container) – The input container with leaves to be normalized.
axis (Optional[Union[int, Container]], default: None) – The axis along which to normalize.
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. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – A container containing the normalized leaves.
ivy.Container instance method variant of ivy.l2_normalize. This
method simply wraps the function, and so the docstring for
ivy.l2_normalize also applies to this method with minimal changes.
Parameters:
self (Container) – The input container with leaves to be normalized.
axis (Optional[Union[int, Container]], default: None) – The axis along which to normalize.
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. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – a container containing the normalized leaves.
ivy.Container instance method variant of ivy.l2_normalize. This
method simply wraps the function, and so the docstring for
ivy.l2_normalize also applies to this method with minimal changes.
Parameters:
self (Container) – The input container with leaves to be normalized.
axis (Optional[Union[int, Container]], default: None) – The axis along which to normalize.
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. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – a container containing the normalized leaves.
ivy.Container static method variant of ivy.batch_norm. This method
simply wraps the function, and so the docstring for ivy.batch_norm also
applies to this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – Input array of default shape (N, *S, C), where N is the batch dimension,
*S corresponds to any number of spatial dimensions and
C corresponds to the channel dimension.
mean (Optional[Union[Array, NativeArray, Container]]) – Mean array used for input’s normalization. It can be of any shape
braodcastable to (N,*S,C).
variance (Optional[Union[Array, NativeArray, Container]]) – Variance array used for input’s normalization. It can be of any shape
braodcastable to (N,*S,C).
offset (Optional[Union[Array, NativeArray, Container]], default: None) – An offset array. If present, will be added to the normalized input.
It can be of any shape broadcastable to (N,*S,C).
scale (Optional[Union[Array, NativeArray, Container]], default: None) – A scale array. If present, the scale is applied to the normalized input.
It can be of any shape broadcastable to (N,*S,C).
training (Union[bool, Container], default: False) – If true, calculate and use the mean and variance of x. Otherwise, use the
provided mean and variance.
eps (Union[float, Container], default: 1e-05) – A small float number to avoid dividing by 0.
the value used for the running_mean and running_var computation.
Default value is 0.1.
data_format (Union[str, Container], default: 'NSC') – The ordering of the dimensions in the input, one of “NSC” or “NCS”,
where N is the batch dimension, S represents any number of spatial
dimensions and C is the channel dimension. Default is “NSC”.
out (Optional[Tuple[Union[Array, Container], Union[Array, Container], Union[Array, Container]]], default: None) – optional output arrays, for writing the result to.
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.
Return type:
Tuple[Container, Container, Container]
Returns:
ret –
Tuple of containers containing
the normalized input, running mean, and running variance.
ivy.Container static method variant of ivy.group_norm. This method
simply wraps the function, and so the docstring for ivy.group_norm also
applies to this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) – Input array of default shape (N, *S, C), where N is the batch dimension,
*S corresponds to any number of spatial dimensions and
C corresponds to the channel dimension.
num_groups (Union[int, Container], default: 1) – number of groups to separate the channels into
offset (Optional[Union[Array, NativeArray, Container]], default: None) – An offset array of size C. If present, will be added
to the normalized input.
scale (Optional[Union[Array, NativeArray, Container]], default: None) – A scale array of size C. If present, the scale is
applied to the normalized input.
eps (Union[float, Container], default: 1e-05) – A small float number to avoid dividing by 0.
data_format (Union[str, Container], default: 'NSC') – The ordering of the dimensions in the input, one of “NSC” or “NCS”,
where N is the batch dimension, S represents any number of spatial
dimensions and C is the channel dimension. Default is “NSC”.
out (Optional[Union[Array, Container]], default: None) – optional output arrays, for writing the result to.
ivy.Container static method variant of ivy.instance_norm. This
method simply wraps the function, and so the docstring for
ivy.instance_norm also applies to this method with minimal changes.
Parameters:
x (Union[Array, NativeArray, Container]) –
Input array of shape default (N, *S, C), where N is the batch dimension,
*S corresponds to any number of spatial dimensions and
C corresponds to the channel dimension.
mean (Optional[Union[Array, NativeArray, Container]]) – Mean array of size C used for input’s normalization.
variance (Optional[Union[Array, NativeArray, Container]]) – Variance array of size C used for input’s normalization.
the value used for the running_mean and running_var computation.
Default value is 0.1.
data_format (Union[str, Container], default: 'NSC') – The ordering of the dimensions in the input, one of “NSC” or “NCS”,
where N is the batch dimension, S represents any number of spatial
dimensions and C is the channel dimension. Default is “NSC”.
out (Optional[Tuple[Union[Array, Container], Union[Array, Container], Union[Array, Container]]], default: None) – optional output arrays, for writing the result to.
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.
Return type:
Tuple[Container, Container, Container]
Returns:
ret –
Tuple of containers
containing the normalized input, running mean, and running variance.
ivy.Container static method variant of ivy.l1_normalize. This method
simply wraps the function, and so the docstring for ivy.l1_normalize
also applies to this method with minimal changes.
Parameters:
x (Union[Container, Array, NativeArray]) – The input container with leaves to be normalized.
axis (Optional[Union[int, Container]], default: None) – The axis along which to normalize.
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. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – a container containing the normalized leaves.
ivy.Container static method variant of ivy.l2_normalize. This method
simply wraps the function, and so the docstring for ivy.l2_normalize
also applies to this method with minimal changes.
Parameters:
x (Union[Container, Array, NativeArray]) – The input container with leaves to be normalized.
axis (Optional[Union[int, Container]], default: None) – The axis along which to normalize.
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. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – a container containing the normalized leaves.
ivy.Container static method variant of ivy.lp_normalize. This method
simply wraps the function, and so the docstring for ivy.lp_normalize
also applies to this method with minimal changes.
Parameters:
x (Union[Container, Array, NativeArray]) – The input container with leaves to be normalized.
p (Union[float, Container], default: 2) – The order of the norm.
axis (Optional[Union[int, Container]], default: None) – The axis along which to normalize.
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. It must have a shape
that the inputs broadcast to.
Return type:
Container
Returns:
ret – a container containing the normalized leaves.
self (Container) – An N-D Array representing the probability of a 1 event.
Each entry in the Array parameterizes an independent
Bernoulli distribution. Only one of logits or probs should
be passed in.
logits (Optional[Union[float, Array, NativeArray, Container]], default: None) – An N-D Array representing the log-odds of a 1 event.
Each entry in the Array parameterizes an independent Bernoulli
distribution where the probability of an event is
sigmoid(logits). Only one of logits or probs should be passed in.
shape (Optional[Union[Shape, NativeShape, Container]], default: None) – If the given shape is, e.g ‘(m, n, k)’, then ‘m * n * k’ samples are drawn.
(Default value = ‘None’, where ‘ivy.shape(logits)’ samples are drawn)
device (Optional[Union[Device, NativeDevice, Container]], default: None) – device on which to create the array ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc.
(Default value = None).
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – output array data type. If dtype is None, the output array data
type will be the default floating-point data type. Default None
seed (Optional[Union[int, Container]], default: None) – A python integer. Used to create a random seed distribution
out (Optional[Container], default: None) – optional output array, for writing the result to.
It must have a shape that the inputs broadcast to.
Return type:
Container
Returns:
ret – Drawn samples from the Bernoulli distribution
ivy.Container instance method variant of ivy.beta. This method
simply wraps the function, and so the docstring for ivy.beta also
applies to this method with minimal changes.
Parameters:
self (Container) – Input container. Should have a numeric data type.
alpha – The alpha parameter of the distribution.
beta (Union[int, float, Container, Array, NativeArray]) – The beta parameter of the distribution.
shape (Optional[Union[Shape, NativeShape, Container]], default: None) – The shape of the output array. Default is None.
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.
device (Optional[Union[str, Container]], default: None) – The device to place the output array on. Default is None.
dtype (Optional[Union[str, Container]], default: None) – The data type of the output array. Default is None.
seed (Optional[Union[int, Container]], default: None) – A python integer. Used to create a random seed distribution
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 object, with values drawn from the beta distribution.
ivy.Container instance method variant of ivy.dirichlet. This method
simply wraps the function, and so the docstring for ivy.shuffle also
applies to this method with minimal changes.
Parameters:
self (Container) – Sequence of floats of length k
size (Optional[Union[Shape, NativeShape, Container]], default: None) – optional container including ints or tuple of ints,
Output shape for the arrays in the input container.
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – output container array data type. If dtype is None, the output data
type will be the default floating-point data type. Default None
seed (Optional[Union[int, Container]], default: None) – A python integer. Used to create a random seed distribution
out (Optional[Container], default: None) – optional output container, for writing the result to.
ivy.Container method variant of ivy.gamma. This method simply wraps
the function, and so the docstring for ivy.gamma also applies to this
method with minimal changes.
Parameters:
self (Container) – First parameter of the distribution.
beta (Union[int, float, Container, Array, NativeArray]) – Second parameter of the distribution.
shape (Optional[Union[Shape, NativeShape, Container]], default: None) – If the given shape is, e.g ‘(m, n, k)’, then ‘m * n * k’ samples are drawn.
(Default value = ‘None’, where ‘ivy.shape(logits)’ samples are drawn)
device (Optional[Union[str, Container]], default: None) – device on which to create the array ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc.
(Default value = None).
dtype (Optional[Union[str, Container]], default: None) – output array data type. If dtype is None, the output array data
type will be the default floating-point data type. Default None
ivy.Container instance method variant of ivy.poisson. This method
simply wraps the function, and so the docstring for ivy.poisson also
applies to this method with minimal changes.
Parameters:
self (Container) – Input container with rate parameter(s) describing the poisson
distribution(s) to sample.
shape (Optional[Union[Shape, NativeShape, Container]], default: None) – optional container including ints or tuple of ints,
Output shape for the arrays in the input container.
device (Optional[Union[Device, NativeDevice, Container]], default: None) – device on which to create the array ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc.
(Default value = None).
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – output container array data type. If dtype is None, the output data
type will be the default floating-point data type. Default None
seed (Optional[Union[int, Container]], default: None) – A python integer. Used to create a random seed distribution.
fill_value (Optional[Union[float, int, Container]], default: 0) – if lam is negative, fill the output array with this value
on that specific dimension.
out (Optional[Container], default: None) – optional output container, for writing the result to.
probs (Container) – An N-D Array representing the probability of a 1 event.
Each entry in the Array parameterizes an independent Bernoulli
distribution. Only one of logits or probs should be passed in
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.
logits (Optional[Union[float, Array, NativeArray, Container]], default: None) – An N-D Array representing the log-odds of a 1 event.
Each entry in the Array parameterizes an independent Bernoulli
distribution where the probability of an event is sigmoid
(logits). Only one of logits or probs should be passed in.
shape (Optional[Union[Shape, NativeShape, Container]], default: None) – If the given shape is, e.g ‘(m, n, k)’, then ‘m * n * k’ samples are drawn.
(Default value = ‘None’, where ‘ivy.shape(logits)’ samples are drawn)
device (Optional[Union[Device, NativeDevice, Container]], default: None) – The device to place the output array on. Default is None.
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – The data type of the output array. Default is None.
seed (Optional[Union[int, Container]], default: None) – A python integer. Used to create a random seed distribution
out (Optional[Union[Array, 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 – Drawn samples from the Bernoulli distribution
ivy.Container static method variant of ivy.beta. This method simply
wraps the function, and so the docstring for ivy.beta also applies to
this method with minimal changes.
Parameters:
x – Input array or container. Should have a numeric data type.
alpha (Container) – The alpha parameter of the distribution.
beta (Union[int, float, Container, Array, NativeArray]) – The beta parameter of the distribution.
shape (Optional[Union[Shape, NativeShape, Container]], default: None) – The shape of the output array. Default is None.
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.
device (Optional[Union[str, Container]], default: None) – The device to place the output array on. Default is None.
dtype (Optional[Union[str, Container]], default: None) – The data type of the output array. Default is None.
seed (Optional[Union[int, Container]], default: None) – A python integer. Used to create a random seed distribution
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 object, with values drawn from the beta distribution.
ivy.Container static method variant of ivy.dirichlet. This method
simply wraps the function, and so the docstring for ivy.dirichlet also
applies to this method with minimal changes.
Parameters:
alpha (Container) – Sequence of floats of length k
size (Optional[Union[Shape, NativeShape, Container]], default: None) – optional container including ints or tuple of ints,
Output shape for the arrays in the input container.
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – output container array data type. If dtype is None, the output data
type will be the default floating-point data type. Default None
seed (Optional[Union[int, Container]], default: None) – A python integer. Used to create a random seed distribution
out (Optional[Container], default: None) – optional output container, for writing the result to.
ivy.Container static method variant of ivy.gamma. This method simply
wraps the function, and so the docstring for ivy.gamma also applies to
this method with minimal changes.
Parameters:
alpha (Container) – First parameter of the distribution.
beta (Union[int, float, Container, Array, NativeArray]) – Second parameter of the distribution.
shape (Optional[Union[Shape, NativeShape, Container]], default: None) – If the given shape is, e.g ‘(m, n, k)’, then ‘m * n * k’ samples are drawn.
(Default value = ‘None’, where ‘ivy.shape(logits)’ samples are drawn)
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.
device (Optional[Union[str, Container]], default: None) – device on which to create the array ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc.
(Default value = None).
dtype (Optional[Union[str, Container]], default: None) – output array data type. If dtype is None, the output array data
type will be the default floating-point data type. Default None
seed (Optional[Union[int, Container]], default: None) – A python integer. Used to create a random seed distribution
out (Optional[Container], default: None) – Optional output container, for writing the result to. It must have a shape
that the inputs broadcast to.
Returns:
ret – Drawn samples from the parameterized gamma distribution with the shape of
the input Container.
ivy.Container static method variant of ivy.poisson. This method
simply wraps the function, and so the docstring for ivy.poisson also
applies to this method with minimal changes.
Parameters:
lam (Container) – Input container with rate parameter(s) describing the poisson
distribution(s) to sample.
shape (Optional[Union[Shape, NativeShape, Container]], default: None) – optional container including ints or tuple of ints,
Output shape for the arrays in the input container.
device (Optional[Union[Device, NativeDevice, Container]], default: None) – device on which to create the array ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc.
(Default value = None).
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – output container array data type. If dtype is None, the output data
type will be the default floating-point data type. Default None
seed (Optional[Union[int, Container]], default: None) – A python integer. Used to create a random seed distribution.
fill_value (Optional[Union[float, int, Container]], default: 0) – if lam is negative, fill the output array with this value
on that specific dimension.
out (Optional[Container], default: None) – optional output container, for writing the result to.
ivy.Container static method variant of ivy.unravel_index. This
method simply wraps the function, and so the docstring for
ivy.unravel_index also applies to this method with minimal changes.
Parameters:
indices (Container) – Input container including arrays.
shape (Union[Tuple[int], Container]) – The shape of the array to use for unraveling indices.
out (Optional[Union[Array, Container]], default: None) – optional output array, for writing the result to.
Return type:
Container
Returns:
ret – Container with tuples that have arrays with the same shape as
the arrays in the input container.
Examples
With one ivy.Container input:
>>> indices = ivy.Container(a=ivy.array([22, 41, 37])), b=ivy.array([30, 2]))
>>> ivy.Container.static_unravel_index(indices, (7,6))
{
ivy.Container instance method variant of ivy.unravel_index. This
method simply wraps the function, and so the docstring for
ivy.unravel_index also applies to this method with minimal changes.
Parameters:
self (Container) – Input container including arrays.
shape (Union[Tuple[int], Container]) – The shape of the array to use for unraveling indices.
out (Optional[Container], default: None) – optional output array, for writing the result to.
Return type:
Container
Returns:
ret – Container with tuples that have arrays with the same shape as
the arrays in the input container.
Examples
With one ivy.Container input:
>>> indices = ivy.Container(a=ivy.array([22, 41, 37])), b=ivy.array([30, 2]))
>>> indices.unravel_index((7, 6))
{
ivy.Container instance method variant of ivy.lexsort. This method
simply wraps the function, and so the docstring for ivy.lexsort also
applies to this method with minimal changes.
Parameters:
self (Container) – input container with array-like inputs to sort as keys.
axis (Union[int, Container], default: -1) – axis of each key to be indirectly sorted.
By default, sort over the last axis of each key.
out (Optional[Container], default: None) – optional output container, for writing the result to.
Return type:
Container
Returns:
ret – a container containing the sorted input arrays.
ivy.Container static method variant of ivy.lexsort. This method
simply wraps the function, and so the docstring for ivy.lexsort also
applies to this method with minimal changes.
Parameters:
a (Union[Array, NativeArray, Container]) – array-like or container input to sort as keys.
axis (Union[int, Container], default: -1) – axis of each key to be indirectly sorted.
By default, sort over the last axis of each key.
out (Optional[Container], default: None) – optional output container, for writing the result to.
ivy.Container static method variant of ivy.cummax. This method
simply wraps the function, and so the docstring for ivy.cummax also
applies to this method with minimal changes.
Parameters:
x (Union[Container, Array, NativeArray]) – Input array or container to cummax.
axis (Union[int, Container], default: 0) – Axis to cummax along. Default is 0.
exclusive (Union[bool, Container], default: False) – Whether to exclude the first element of the input array.
Default is False.
reverse (Union[bool, Container], default: False) – Whether to perform the cummax from last to first element in the selected
axis. Default is False (from first to last element)
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. Default is None.
Return type:
Container
Returns:
ret – Containers with arrays cummax at leaves along specified axis.
——–
With one ivy.Container input
>>> x = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([4, 5, 6]))
ivy.Container static method variant of ivy.cummin. This method
simply wraps the function, and so the docstring for ivy.cummin also
applies to this method with minimal changes.
Parameters:
x (Union[Container, Array, NativeArray]) – Input array or container to cummin.
axis (Union[int, Container], default: 0) – Axis to cummin along. Default is 0.
exclusive (Union[bool, Container], default: False) – Whether to exclude the first element of the input array.
Default is False.
reverse (Union[bool, Container], default: False) – Whether to perform the cummin from last to first element in the selected
axis. Default is False (from first to last element)
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.
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – Data type of the returned array. Default is None.
out (Optional[Container], default: None) – Optional output container. Default is None.
Return type:
Container
Returns:
ret – Containers with arrays cummin at leaves along specified axis.
Examples #TODO (fix examples and this doc)
——–
With one ivy.Container input
>>> x = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([4, 5, 6]))
ivy.Container static method variant of ivy.nanmin. This method
simply wraps the function, and so the docstring for ivy.nanmin also
applies to this method with minimal changes.
Parameters:
input – Input container including arrays.
axis (Optional[Union[int, Tuple[int], Container]], default: None) – Axis or axes along which the minimum is computed.
The default is to compute the minimum of the flattened array.
out (Optional[Array], default: None) – optional output array, for writing the result to.
keepdims (Optional[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. With this option, the result will broadcast
correctly against the original a.
initial (Optional[Union[int, float, complex, Container]], default: None) – The maximum value of an output element
where (Optional[Union[Array, Container]], default: None) – Elements to compare for the minimum
Return type:
Container
Returns:
ret – Return minimum of an array or minimum along an axis, ignoring any NaNs.
ivy.Array instance method variant of ivy.bincount. This method
simply wraps the function, and so the docstring for ivy.bincount also
applies to this method with minimal changes.
Parameters:
self (Container) – Input array.
weights (Optional[Container], default: None) – An optional input array.
minlength (Union[int, Container], default: 0) – A minimum number of bins for the output array.
ivy.Container instance method variant of ivy.corrcoef. This method
simply wraps the function, and so the docstring for ivy.corrcoef also
applies to this method with minimal changes.
Parameters:
self (Container) – Input container including arrays.
y (Optional[Container], default: None) – An additional input container.
rowvar (Union[bool, Container], default: True) – If rowvar is True (default), then each row represents a variable, with
observations in the columns. Otherwise, the relationship is transposed:
each column represents a variable, while the rows contain observations.
Return type:
Container
Returns:
ret – The corrcoef of the array elements in the input container.
ivy.Container instance method variant of ivy.cov. This method simply
wraps the function, and so the docstring for ivy.cov also applies to
this method with minimal changes.
Parameters:
self (Container) – a 1D or 2D input container, with a numeric data type.
x2 (Optional[Container], default: None) – optional second 1D or 2D input array, nativearray, or container, with a
numeric data type. Must have the same shape as self.
rowVar (Union[bool, Container], default: True) – optional variable where each row of input is interpreted as a variable
(default = True). If set to False, each column is instead interpreted
as a variable.
bias (Union[bool, Container], default: False) – optional variable for normalizing input (default = False) by (N - 1) where
N is the number of given observations. If set to True, then normalization
is instead by N. Can be overridden by keyword ddof.
ddof (Optional[Union[int, Container]], default: None) – optional variable to override bias (default = None). ddof=1 will return
the unbiased estimate, even with fweights and aweights given. ddof=0 will
return the simple average.
fweights (Optional[Union[Array, Container]], default: None) – optional 1D array of integer frequency weights; the number of times each
observation vector should be repeated.
aweights (Optional[Union[Array, Container]], default: None) – optional 1D array of observation vector weights. These relative weights are
typically large for observations considered “important” and smaller for
observations considered less “important”. If ddof=0 is specified, the array
of weights can be used to assign probabilities to observation vectors.
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – optional variable to set data-type of the result. By default, data-type
will have at least numpy.float64 precision.
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 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 covariance matrix of an input matrix, or the
covariance matrix of two variables. The returned container must have a
floating-point data type determined by Type Promotion Rules and must be
a square matrix of shape (N, N), where N is the number of variables in the
input(s).
ivy.Container instance method variant of ivy.cummax. This method
simply wraps the function, and so the docstring for ivy.cummax also
applies to this method with minimal changes.
Parameters:
self (Container) – Input container to cummax at leaves.
axis (Union[int, Container], default: 0) – Axis along which the cumulative product is computed. Default is 0.
exclusive (Union[bool, Container], default: False) – Whether to exclude the first element of the input array.
Default is 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 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.
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – Data type of the returned array. Default is None.
out (Optional[Container], default: None) – Optional output container. Default is None.
Return type:
Container
Returns:
ret – Containers with arrays cummax at leaves along specified axis.
——–
With one ivy.Container instances
>>> x = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([4, 5, 6]))
ivy.Container instance method variant of ivy.cummin. This method
simply wraps the function, and so the docstring for ivy.cummin also
applies to this method with minimal changes.
Parameters:
self (Container) – Input container to cummin at leaves.
axis (Union[int, Container], default: 0) – Axis along which the cumulative product is computed. Default is 0.
exclusive (Union[bool, Container], default: False) – Whether to exclude the first element of the input array.
Default is 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 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.
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – Data type of the returned array. Default is None.
out (Optional[Container], default: None) – Optional output container. Default is None.
Return type:
Container
Returns:
ret – Containers with arrays cummin at leaves along specified axis.
Examples #TODO (change examples and change doc string)
——–
With one ivy.Container instances
>>> x = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([4, 5, 6]))
ivy.Container instance method variant of ivy.<func_name>. This
method simply wraps the function, and so the docstring for
ivy.histogram also applies to this method with minimal changes.
Parameters:
self (Container) – input array.
bins (Optional[Union[int, Array, NativeArray, Container, str]], default: None) – if bins is an int, it defines the number of equal-width bins in the
given range.
if bins is an array, it defines a monotonically increasing array of bin
edges, including the rightmost edge, allowing for non-uniform bin widths.
axis (Optional[Union[Array, NativeArray, Container]], default: None) – dimension along which maximum values must be computed. By default, the
maximum value must be computed over the entire array. Default: None.
extend_lower_interval (Optional[Union[bool, Container]], default: False) – if True, extend the lowest interval I0 to (-inf, c1].
extend_upper_interval (Optional[Union[bool, Container]], default: False) – ff True, extend the upper interval I_{K-1} to [c_{K-1}, +inf).
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – the output type.
range (Optional[Union[Tuple[float], Container]], default: None) – the lower and upper range of the bins. The first element of the range must
be less than or equal to the second.
weights (Optional[Union[Array, NativeArray, Container]], default: None) – each value in a only contributes its associated weight towards the bin
count (instead of 1). Must be of the same shape as a.
density (Optional[Union[bool, Container]], default: False) – if True, the result is the value of the probability density function at the
bin, normalized such that the integral over the range of bins is 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 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, for writing the result to. It must have a shape that the
inputs broadcast to.
Return type:
Container
Returns:
ret – a tuple containing the values of the histogram and the bin edges.
Both the description and the type hints above assumes an array input for
simplicity, but this function is *nestable, and therefore also accepts*
ivy.Container instances in place of any of the arguments.
ivy.Container instance method variant of ivy.igamma. This method
simply wraps the function, and so the docstring for ivy.igamma also
applies to this method with minimal changes.
Parameters:
self (Container) – Input array.
x (Union[Container, Array, NativeArray]) – An additional input array.
x has the same type as a.
out (Optional[Container], default: None) – optional output array, for writing the result to.
Return type:
Container
Returns:
ret – The lower incomplete gamma function of the array elements.
ivy.Container instance method variant of ivy.median. This method
simply wraps the function, and so the docstring for ivy.median also
applies to this method with minimal changes.
Parameters:
self (Container) – Input container including arrays.
axis (Optional[Union[int, Tuple[int], Container]], default: None) – Axis or axes along which the medians are computed. The default is to compute
the median along a flattened version of the array.
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) – optional output array, for writing the result to.
Return type:
Container
Returns:
ret – The median of the array elements.
Examples
With one ivy.Container input:
>>> x = ivy.Container(
>>> a=ivy.array([[10, 7, 4], [3, 2, 1]]),
>>> b=ivy.array([[1, 4, 2], [8, 7, 0]])
>>> )
>>> x.median(axis=0)
{
ivy.Container instance method variant of ivy.nanmean. This method
simply wraps the function, and so the docstring for ivy.nanmean also
applies to this method with minimal changes.
Parameters:
self (Container) – Input container including arrays.
axis (Optional[Union[int, Tuple[int], Container]], default: None) – Axis or axes along which the means are computed.
The default is to compute the mean of the flattened array.
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. With this option, the result will broadcast
correctly against the original a. If the value is anything but the default,
then keepdims will be passed through to the mean or sum methods of
sub-classes of ndarray. If the sub-classes methods does not implement
keepdims any exceptions will be raised.
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – The desired data type of returned tensor. Default is None.
out (Optional[Container], default: None) – optional output array, for writing the result to.
Return type:
Container
Returns:
ret – The nanmean of the array elements in the input container.
ivy.Container instance method variant of ivy.nanmedian. This method
simply wraps the function, and so the docstring for ivy.nanmedian also
applies to this method with minimal changes.
Parameters:
self (Container) – Input array.
axis (Optional[Union[int, Tuple[int], Container]], default: None) – The axis or axes along which the means are computed.
The default is to compute the mean of the flattened array.
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. With this option, the result will broadcast
correctly against the original container. If the value is anything
but the default, then keepdims will be passed through to the mean or
sum methods of sub-classes of ndarray. If the sub-classes methods
does not implement keepdims any exceptions will be raised.
overwrite_input (Union[bool, Container], default: False) – If True, then allow use of memory of input array a for calculations.
The input array will be modified by the call to median.
This will save memory when you do not need to preserve
the contents of the input array.Treat the input as undefined,
but it will probably be fully or partially sorted.
Default is False. If overwrite_input is True and
input container does not already have leaves which are
of the ndarray kind, an error will be raised.
out (Optional[Container], default: None) – optional output array, for writing the result to.
Return type:
Container
Returns:
ret – A new array holding the result. If the input contains integers
Examples
With ivy.Container input and default backend set as numpy:
>>> x = ivy.Container(a=ivy.array([[10.0, ivy.nan, 4], [3, 2, 1]]),
ivy.Container instance method variant of ivy.nanmin. This method
simply wraps the function, and so the docstring for ivy.nanmin also
applies to this method with minimal changes.
Parameters:
self (Container) – Input container including arrays.
axis (Optional[Union[int, Tuple[int], Container]], default: None) – Axis or axes along which the minimum is computed.
The default is to compute the minimum of the flattened array.
out (Optional[Container], default: None) – optional output array, for writing the result to.
keepdims (Optional[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. With this option, the result will broadcast
correctly against the original a.
initial (Optional[Union[int, float, complex, Container]], default: None) – The maximum value of an output element.
where (Optional[Union[Array, Container]], default: None) – Elements to compare for the minimum.
Return type:
Container
Returns:
ret – Return minimum of an array or minimum along an axis, ignoring any NaNs
ivy.Container instance method variant of ivy.nanprod. This method
simply wraps the function, and so the docstring for ivy.nanprod also
applies to this method with minimal changes.
Parameters:
self (Container) – Input container including arrays.
axis (Optional[Union[int, Tuple[int], Container]], default: None) – Axis or axes along which the product is computed.
The default is to compute the product of the flattened array.
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – The desired data type of returned array. Default is None.
out (Optional[Container], default: None) – optional output array, for writing the result to.
keepdims (Optional[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. With this option, the result will broadcast
correctly against the original a.
initial (Optional[Union[int, float, complex, Container]], default: None) – The starting value for this product.
where (Optional[Union[Array, Container]], default: None) – Elements to include in the product
Return type:
Container
Returns:
ret – The product of array elements over a given axis treating
Not a Numbers (NaNs) as ones
ivy.Container instance method variant of ivy.quantile. This method
simply wraps the function, and so the docstring for ivy.quantile also
applies to this method with minimal changes.
Parameters:
a – Input container including arrays.
q (Union[Array, float, Container]) – Quantile or sequence of quantiles to compute, which must be
between 0 and 1 inclusive.
axis (Optional[Union[int, Sequence[int], Container]], default: None) – Axis or axes along which the quantiles are computed. The default
is to compute the quantile(s) along a flattened version of the array.
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. With this option, the result will broadcast
correctly against the original array a.
interpolation (Union[str, Container], default: 'linear') – {‘nearest’, ‘linear’, ‘lower’, ‘higher’, ‘midpoint’}. Default value:
‘linear’.
This specifies the interpolation method to use when the desired quantile
lies between two data points i < j:
- linear: i + (j - i) * fraction, where fraction is the fractional part of
the index surrounded by i and j.
- lower: i.
- higher: j.
- nearest: i or j, whichever is nearest.
- midpoint: (i + j) / 2. linear and midpoint interpolation do not work with
integer dtypes.
out (Optional[Container], default: None) – optional output array, for writing the result to.
Return type:
Container
Returns:
ret – Container with (rank(q) + N - len(axis)) dimensional arrays of same dtype
as input arrays in the container, or, if axis is None, rank(q) arrays. The
first rank(q) dimensions index quantiles for different values of q.
ivy.Container static method variant of ivy.bincount. This method
simply wraps the function, and so the docstring for ivy.bincount also
applies to this method with minimal changes.
Parameters:
x (Container) – Input container including arrays.
weights (Optional[Container], default: None) – An optional input container including arrays.
minlength (Union[int, Container], default: 0) – A minimum number of bins for the output array.
Return type:
Container
Returns:
ret – The bincount of the array elements.
Examples
With one ivy.Container input:
>>> x = ivy.Container(a=ivy.array([1, 1, 2, 2, 2, 3]),
ivy.Container static method variant of ivy.corrcoef. This method
simply wraps the function, and so the docstring for ivy.corrcoef also
applies to this method with minimal changes.
Parameters:
x (Container) – Input container including arrays.
y (Optional[Container], default: None) – An additional input container.
rowvar (Union[bool, Container], default: True) – If rowvar is True (default), then each row represents a variable, with
observations in the columns. Otherwise, the relationship is transposed:
each column represents a variable, while the rows contain observations.
Return type:
Container
Returns:
ret – The corrcoef of the array elements in the container.
ivy.Container static method variant of ivy.cov. This method simply
wraps the function, and so the docstring for ivy.cov also applies to
this method with minimal changes.
Parameters:
x1 (Union[Array, NativeArray, Container]) – a 1D or 2D input array, nativearray or container, with a numeric data type.
x2 (Optional[Union[Array, NativeArray, Container]], default: None) – optional second 1D or 2D input array, nativearray, or container, with a
numeric data type. Must have the same shape as x1.
rowVar (Union[bool, Container], default: True) – optional variable where each row of input is interpreted as a variable
(default = True). If set to False, each column is instead interpreted
as a variable.
bias (Union[bool, Container], default: False) – optional variable for normalizing input (default = False) by (N - 1) where
N is the number of given observations. If set to True, then normalization
is instead by N. Can be overridden by keyword ddof.
ddof (Optional[Union[int, Container]], default: None) – optional variable to override bias (default = None). ddof=1 will return
the unbiased estimate, even with fweights and aweights given. ddof=0 will
return the simple average.
fweights (Optional[Union[Array, Container]], default: None) – optional 1D array of integer frequency weights; the number of times each
observation vector should be repeated.
aweights (Optional[Union[Array, Container]], default: None) – optional 1D array of observation vector weights. These relative weights are
typically large for observations considered “important” and smaller for
observations considered less “important”. If ddof=0 is specified, the array
of weights can be used to assign probabilities to observation vectors.
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – optional variable to set data-type of the result. By default, data-type
will have at least numpy.float64 precision.
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 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 covariance matrix of an input matrix, or the
covariance matrix of two variables. The returned container must have a
floating-point data type determined by Type Promotion Rules and must be
a square matrix of shape (N, N), where N is the number of rows in the
input(s).
Examples
With one ivy.Container input:
>>> x = ivy.array([1., 2., 3.])
>>> y = ivy.Container(a=ivy.array([3. ,2. ,1.]), b=ivy.array([-1., -2., -3.]))
>>> z = ivy.Container.static_cov(x, y)
>>> print(z)
{
a: ivy.array([ 1., -1.]
[-1., 1.]),
b: ivy.array([ 1., -1.]
[-1., 1.])
}
With multiple ivy.Container inputs:
>>> x = ivy.Container(a=ivy.array([1., 2., 3.]), b=ivy.array([1., 2., 3.]))
>>> y = ivy.Container(a=ivy.array([3., 2., 1.]), b=ivy.array([3., 2., 1.]))
>>> z = ivy.Container.static_cov(x, y)
>>> print(z)
{
ivy.Container static method variant of ivy.<func_name>. This method
simply wraps the function, and so the docstring for ivy.histogram also
applies to this method with minimal changes.
Parameters:
a (Union[Array, NativeArray, Container]) – input array.
bins (Optional[Union[int, Array, NativeArray, Container, str]], default: None) – if bins is an int, it defines the number of equal-width bins in the
given range.
if bins is an array, it defines a monotonically increasing array of bin
edges, including the rightmost edge, allowing for non-uniform bin widths.
axis (Optional[Union[Array, NativeArray, Container]], default: None) – dimension along which maximum values must be computed. By default, the
maximum value must be computed over the entire array. Default: None.
extend_lower_interval (Optional[Union[bool, Container]], default: False) – if True, extend the lowest interval I0 to (-inf, c1].
extend_upper_interval (Optional[Union[bool, Container]], default: False) – ff True, extend the upper interval I_{K-1} to [c_{K-1}, +inf).
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – the output type.
range (Optional[Tuple[Union[bool, Container]]], default: None) – the lower and upper range of the bins. The first element of the range must
be less than or equal to the second.
weights (Optional[Union[Array, NativeArray, Container]], default: None) – each value in a only contributes its associated weight towards the bin
count (instead of 1). Must be of the same shape as a.
density (Optional[Union[bool, Container]], default: False) – if True, the result is the value of the probability density function at the
bin, normalized such that the integral over the range of bins is 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 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, for writing the result to. It must have a shape that the
inputs broadcast to.
Return type:
Container
Returns:
ret – a tuple containing the values of the histogram and the bin edges.
Both the description and the type hints above assumes an array input for
simplicity, but this function is *nestable, and therefore also accepts*
ivy.Container instances in place of any of the arguments.
ivy.Container static method variant of ivy.igamma. This method
simply wraps the function, and so the docstring for ivy.igamma also
applies to this method with minimal changes.
Parameters:
self – Input array.
x (Union[Container, Array, NativeArray]) – An additional input array.
x has the same type as a.
out (Optional[Container], default: None) – optional output array, for writing the result to.
Return type:
Container
Returns:
ret – The lower incomplete gamma function of the array elements.
ivy.Container static method variant of ivy.median. This method
simply wraps the function, and so the docstring for ivy.median also
applies to this method with minimal changes.
Parameters:
input (Container) – Input container including arrays.
axis (Optional[Union[int, Tuple[int], Container]], default: None) – Axis or axes along which the medians are computed. The default is to compute
the median along a flattened version of the array.
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) – optional output array, for writing the result to.
Return type:
Container
Returns:
ret – The median of the array elements.
Examples
With one ivy.Container input:
>>> x = ivy.Container(a=ivy.zeros((3, 4, 5)), b=ivy.zeros((2,7,6)))
>>> ivy.Container.static_moveaxis(x, 0, -1).shape
{
ivy.Container static method variant of ivy.nanmean. This method
simply wraps the function, and so the docstring for ivy.nanmean also
applies to this method with minimal changes.
Parameters:
input (Container) – Input container including arrays.
axis (Optional[Union[int, Tuple[int], Container]], default: None) – Axis or axes along which the means are computed.
The default is to compute the mean of the flattened array.
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. With this option, the result will broadcast
correctly against the original a. If the value is anything but the default,
then keepdims will be passed through to the mean or sum methods of
sub-classes of ndarray. If the sub-classes methods does not implement
keepdims any exceptions will be raised.
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – The desired data type of returned tensor. Default is None.
out (Optional[Union[Array, Container]], default: None) – optional output array, for writing the result to.
Return type:
Container
Returns:
ret – The nanmean of the array elements in the container.
ivy.Container static method variant of ivy.median. This method
simply wraps the function, and so the docstring for ivy.median also
applies to this method with minimal changes.
Parameters:
input (Container) – Input container including arrays.
axis (Optional[Union[int, Tuple[int], Container]], default: None) – Axis or axes along which the medians are computed. The default is to compute
the median along a flattened version of the array.
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.
overwrite_input (Union[bool, Container], default: False) – If True, then allow use of memory of input array for calculations.
out (Optional[Union[Array, Container]], default: None) – optional output array, for writing the result to.
Return type:
Container
Returns:
ret – The median of the array elements.
Examples
With one ivy.Container input:
>>> x = ivy.Container(a=ivy.array([[10.0, ivy.nan, 4], [3, 2, 1]]))
>>> ivy.Container.static_nanmedian(x)
{
ivy.Container static method variant of ivy.nanprod. This method
simply wraps the function, and so the docstring for ivy.nanprod also
applies to this method with minimal changes.
Parameters:
input (Container) – Input container including arrays.
axis (Optional[Union[int, Tuple[int], Container]], default: None) – Axis or axes along which the product is computed.
The default is to compute the product of the flattened array.
dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – The desired data type of returned array. Default is None.
out (Optional[Union[Array, Container]], default: None) – optional output array, for writing the result to.
keepdims (Optional[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. With this option, the result will broadcast
correctly against the original a.
initial (Optional[Union[int, float, complex, Container]], default: 1) – The starting value for this product.
where (Optional[Union[Array, Container]], default: None) – Elements to include in the product
Return type:
Container
Returns:
ret – The product of array elements over a given axis treating
Not a Numbers (NaNs) as ones
ivy.Container static method variant of ivy.quantile. This method
simply wraps the function, and so the docstring for ivy.quantile also
applies to this method with minimal changes.
Parameters:
a (Union[Container, Array, NativeArray]) – Input container including arrays.
q (Union[Array, float, Container]) – Quantile or sequence of quantiles to compute, which must be
between 0 and 1 inclusive.
axis (Optional[Union[int, Sequence[int], Container]], default: None) – Axis or axes along which the quantiles are computed. The default
is to compute the quantile(s) along a flattened version of the array.
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. With this option, the result will broadcast
correctly against the original array a.
interpolation (Union[str, Container], default: 'linear') – {‘nearest’, ‘linear’, ‘lower’, ‘higher’, ‘midpoint’}. Default value:
‘linear’.
This specifies the interpolation method to use when the desired quantile
lies between two data points i < j:
- linear: i + (j - i) * fraction, where fraction is the fractional part of
the index surrounded by i and j.
- lower: i.
- higher: j.
- nearest: i or j, whichever is nearest.
- midpoint: (i + j) / 2. linear and midpoint interpolation do not work with
integer dtypes.
out (Optional[Container], default: None) – optional output array, for writing the result to.
Return type:
Container
Returns:
ret – Container with (rank(q) + N - len(axis)) dimensional arrays of same dtype
as input arrays in the container, or, if axis is None, rank(q) arrays. The
first rank(q) dimensions index quantiles for different values of q.
ivy.Container instance method variant of ivy.optional_get_element.
This method simply wraps the function, and so the docstring for
ivy.optional_get_element also applies to this method with minimal
changes.
Parameters:
self (Container) – Input container
out (Optional[Container], default: None) – Optional output container, for writing the result to.
ivy.Container static method variant of ivy.optional_get_element.
This method simply wraps the function, and so the docstring for
ivy.optional_get_element also applies to this method with minimal
changes.
Parameters:
x (Optional[Union[Array, Container]], default: None) – container with array inputs.
key_chains (Optional[Union[List[str], Dict[str, str]]], default: None) – The keychains to apply or not apply the method to. Default is None.
to_apply (bool, default: True) – If True, the method will be applied to key_chains, otherwise key_chains
will be skipped. Default is True.
prune_unapplied (bool, default: False) – Whether to prune key_chains for which the function was not applied.
Default is False.
map_sequences (bool, 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 with arrays flattened at leaves.
This should have hopefully given you an overview of the experimental submodule, if you have any questions, please feel free to reach out on our discord!