Experimental#
- class ivy.data_classes.container.experimental.activations._ContainerWithActivationExperimental(dict_in=None, queues=None, queue_load_sizes=None, container_combine_method='list_join', queue_timeout=None, print_limit=10, key_length_limit=None, print_indent=4, print_line_spacing=0, ivyh=None, default_key_color='green', keyword_color_dict=None, rebuild_child_containers=False, types_to_iteratively_nest=None, alphabetical_keys=True, dynamic_backend=None, **kwargs)[source]#
- _abc_impl = <_abc_data object>#
- static _static_silu(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.silu. This method simply wraps the function, and so the docstring for ivy.silu also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – a container with the rectified linear activation unit function applied element-wise.
Examples
>>> x = ivy.Container(a=ivy.array([1.0, -1.2]), b=ivy.array([0.4, -0.2])) >>> y = ivy.Container.static_silu(x) >>> print(y) { a: ivy.array([0.73105854, -0.27777028]), b: ivy.array([0.23947507, -0.0900332]) }
- logit(*, eps=None, out=None)[source]#
ivy.Container instance method variant of ivy.logit. This method simply wraps the function, and so the docstring for ivy.logit also applies to this method with minimal changes.
- Parameters:
self (
Union
[float
,int
,Container
]) – Input container.eps (
Optional
[float
]) – When eps is None the function outpus NaN where x < 0 or x > 1. (default:None
) and inf or -inf where x = 1 or x = 0, respectively. Otherwise if eps is defined, x is clamped to [eps, 1 - eps]out (
Optional
[Container
]) – Optional output Contaner. (default:None
)
- Return type:
Container
- Returns:
ret – Container with logits of the leaves.
Examples
>>> a = ivy.array([1, 0, 0.9]) >>> b = ivy.array([0.1, 2, -0.9]) >>> x = ivy.Container(a=a, b=b) >>> z = x.logit() >>> print(z) { a: ivy.array([inf, -inf, 2.19722438]), b: ivy.array([-2.19722462, nan, nan]) }
>>> a = ivy.array([0.3, 2, 0.9]) >>> b = ivy.array([0.1, 1.2, -0.9]) >>> x = ivy.Container(a=a, b=b) >>> z = x.logit(eps=0.2) >>> print(z) { a: ivy.array([-0.84729779, 1.38629448, 1.38629448]), b: ivy.array([-1.38629436, 1.38629448, -1.38629436]) }
- logsigmoid(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
Apply element-wise Log-sigmoid of x i.e. log(1 / (1 + exp(-x)).
- Parameters:
self (
Container
) – Input container.- Return type:
Container
- Returns:
ret – Container with Log-sigmoid applied to the leaves.
Examples
>>> x = ivy.Container(a=ivy.array([1.0, -1.2]), b=ivy.array([0.4, -0.2])) >>> y = x.logsigmoid() >>> print(y) { a: ivy.array([-0.31326163, -1.46328258]), b: ivy.array([-0.51301527, -0.79813886]) }
- prelu(slope, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
- Parameters:
slope (
Union
[float
,NativeArray
,Array
,Container
]) –key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – (default:None
)to_apply (
bool
) – (default:True
)prune_unapplied (
bool
) – (default:False
)map_sequences (
bool
) – (default:False
)out (
Optional
[Container
]) – (default:None
)
- Return type:
Container
- relu6(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.relu6. This method simply wraps the function, and so the docstring for ivy.relu6 also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – a container with the rectified linear 6 activation unit function applied element-wise.
Examples
>>> x = { a: ivy.array([-3., -2., -1., 0., 1., 2., 3., 4., 5.]), b: ivy.array([1., 2., 3., 4., 5., 6., 7., 8., 9.]) } >>> y = x.relu() >>> print(y) { a: ivy.array([0., 0., 0., 0., 1., 2., 3., 4., 5.]), b: ivy.array([1., 2., 3., 4., 5., 6., 6., 6., 6.]) }
- selu(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.selu. This method simply wraps the function, and so the docstring for ivy.selu also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – a container with the scaled exponential linear unit activation function applied element-wise.
Examples
>>> x = ivy.Container(a=ivy.array([1.0, -1.2]), b=ivy.array([0.4, -0.2])) >>> y = x.selu() >>> print(y) { a: ivy.array([1.05070102, -1.22856998]), b: ivy.array([0.42028043, -0.31868932]) }
- silu(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.silu. This method simply wraps the function, and so the docstring for ivy.silu also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – a container with the rectified linear activation unit function applied element-wise.
Examples
>>> x = ivy.Container(a=ivy.array([1.0, -1.2]), b=ivy.array([0.4, -0.2])) >>> y = x.silu() >>> print(y) { a: ivy.array([0.73105854, -0.27777028]), b: ivy.array([0.23947507, -0.0900332]) }
- static static_logit(x, /, *, eps=None, out=None)[source]#
ivy.Container static method variant of ivy.logit. This method simply wraps the function, and so the docstring for ivy.logit also applies to this method with minimal changes.
- Parameters:
x (
Union
[float
,int
,Container
]) – Input container.eps (
Optional
[float
]) – When eps is None the function outpus NaN where x < 0 or x > 1. (default:None
) and inf or -inf where x = 1 or x = 0, respectively. Otherwise if eps is defined, x is clamped to [eps, 1 - eps]out (
Optional
[Container
]) – Optional output Contaner. (default:None
)
- Return type:
Container
- Returns:
ret – Container with logits of the leaves.
Examples
>>> a = ivy.array([1, 0, 0.9]) >>> b = ivy.array([0.1, 2, -0.9]) >>> x = ivy.Container(a=a, b=b) >>> z = ivy.Container.static_logit(x) >>> print(z) { a: ivy.array([inf, -inf, 2.19722438]), b: ivy.array([-2.19722462, nan, nan]) }
>>> a = ivy.array([0.3, 2, 0.9]) >>> b = ivy.array([0.1, 1.2, -0.9]) >>> x = ivy.Container(a=a, b=b) >>> z = ivy.Container.static_logit(x, eps=0.2) >>> print(z) { a: ivy.array([-0.84729779, 1.38629448, 1.38629448]), b: ivy.array([-1.38629436, 1.38629448, -1.38629436]) }
- static static_logsigmoid(input, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
ivy.Container static method variant of ivy.logsigmoid. This method simply wraps the function, and so the docstring for ivy.logsigmoid also applies to this method with minimal changes.
- Parameters:
input (
Union
[Array
,NativeArray
,Container
]) – Input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.
- Return type:
Container
- Returns:
Container with Log-sigmoid applied to the leaves.
Examples
>>> a = ivy.array([1, 0, 0.9]) >>> b = ivy.array([0.1, 2, -0.9]) >>> x = ivy.Container(a=a, b=b) >>> z = ivy.Container.static_logsigmoid(x) >>> print(z) { a: ivy.array([-0.31326169, -0.69314718, -0.34115386]), b: ivy.array([-0.64439666, -0.126928, -1.24115384]) }
>>> a = ivy.array([0.3, 2.5, 4.9]) >>> b = ivy.array([0.1, 1.2, -9.]) >>> x = ivy.Container(a=a, b=b) >>> z = ivy.Container.static_logsigmoid(x) >>> print(z) { a: ivy.array([-0.55435526, -0.07888974, -0.00741899]), b: ivy.array([-0.64439666, -0.26328245, -9.00012302]) }
- static static_prelu(x, slope, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
- Parameters:
x (
Union
[NativeArray
,Array
,Container
]) –slope (
Union
[float
,NativeArray
,Array
,Container
]) –key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – (default:None
)to_apply (
bool
) – (default:True
)prune_unapplied (
bool
) – (default:False
)map_sequences (
bool
) – (default:False
)out (
Optional
[Container
]) – (default:None
)
- Return type:
Container
- static static_relu6(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.relu6. This method simply wraps the function, and so the docstring for ivy.relu6 also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – a container with the rectified linear 6 activation unit function applied element-wise.
Examples
>>> x = { a: ivy.array([-3., -2., -1., 0., 1., 2., 3., 4., 5.]), b: ivy.array([1., 2., 3., 4., 5., 6., 7., 8., 9.]) } >>> y = ivy.Container.static_relu6(x) >>> print(y) { a: ivy.array([0., 0., 0., 0., 1., 2., 3., 4., 5.]), b: ivy.array([1., 2., 3., 4., 5., 6., 6., 6., 6.]) }
- static static_selu(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.selu. This method simply wraps the function, and so the docstring for ivy.selu also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – a container with the scaled exponential linear unit activation function applied element-wise.
Examples
>>> x = ivy.Container(a=ivy.array([1.0, -1.2]), b=ivy.array([0.4, -0.2])) >>> y = ivy.Container.static_selu(x) >>> print(y) { a: ivy.array([1.05070102, -1.22856998]), b: ivy.array([0.42028043, -0.31868932]) }
- static static_thresholded_relu(x, /, *, threshold=0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.thresholded_relu. This method simply wraps the function, and so the docstring for ivy.thresholded_relu also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input container.threshold (
Union
[int
,float
]) – threshold value above which the activation is linear. Default:0
. (default:0
)key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – a container with the rectified linear activation unit function applied element-wise with custom threshold.
Examples
>>> x = ivy.Container(a=ivy.array([1.0, -1.2]), b=ivy.array([0.4, -0.2])) >>> y = ivy.Container.static_thresholded_relu(x, threshold=0.5) >>> print(y) { a: ivy.array([1., 0.]), b: ivy.array([0., 0.]) }
- thresholded_relu(*, threshold=0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.thresholded_relu. This method simply wraps the function, and so the docstring for ivy.thresholded_relu also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container.threshold (
Union
[int
,float
]) – threshold value above which the activation is linear. Default:0
. (default:0
)key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – a container with the rectified linear activation unit function applied element-wise with custom threshold.
Examples
>>> x = ivy.Container(a=ivy.array([1.0, -1.2]), b=ivy.array([0.4, -0.2])) >>> y = x.thresholded_relu(threshold=0.5) >>> print(y) { a: ivy.array([1., 0.]), b: ivy.array([0., 0.]) }
- class ivy.data_classes.container.experimental.conversions._ContainerWithConversionExperimental(dict_in=None, queues=None, queue_load_sizes=None, container_combine_method='list_join', queue_timeout=None, print_limit=10, key_length_limit=None, print_indent=4, print_line_spacing=0, ivyh=None, default_key_color='green', keyword_color_dict=None, rebuild_child_containers=False, types_to_iteratively_nest=None, alphabetical_keys=True, dynamic_backend=None, **kwargs)[source]#
- _abc_impl = <_abc_data object>#
- class ivy.data_classes.container.experimental.creation._ContainerWithCreationExperimental(dict_in=None, queues=None, queue_load_sizes=None, container_combine_method='list_join', queue_timeout=None, print_limit=10, key_length_limit=None, print_indent=4, print_line_spacing=0, ivyh=None, default_key_color='green', keyword_color_dict=None, rebuild_child_containers=False, types_to_iteratively_nest=None, alphabetical_keys=True, dynamic_backend=None, **kwargs)[source]#
- _abc_impl = <_abc_data object>#
- eye_like(k=0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, *, out=None, dtype=None, device=None)[source]#
ivy.Container instance method variant of ivy.eye_like. This method simply wraps the function, and so the docstring for ivy.eye_like also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input array or container from which to derive the output container shape.k (
int
) – index of the diagonal. A positive value refers to an upper diagonal, (default:0
) a negative value to a lower diagonal, and 0 to the main diagonal. Default:0
.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.dtype (
Optional
[Union
[Dtype
,NativeDtype
]]) – output array data type. Ifdtype
isNone
, the output container (default:None
) data type must be inferred fromself
. Default:None
.device (
Optional
[Union
[Device
,NativeDevice
]]) – device on which to place the created array. If device isNone
, the (default:None
) output container device must be inferred fromself
. Default:None
.out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a (default:None
) shape that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – a container having the same shape as
x
and filled withones
in diagonalk
andzeros
elsewhere.
Examples
>>> x = ivy.Container(a=ivy.array([3., 8.]), b=ivy.array([2., 2.])) >>> y = x.eye_like() >>> print(y) { a: ivy.array([[1.]]), b: ivy.array([[1.]]) }
- hamming_window(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, periodic=True, alpha=0.54, beta=0.46, dtype=None, out=None)[source]#
ivy.Container instance method variant of ivy.hamming_window. This method simply wraps the function, and so the docstring for ivy.hamming_window also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container including window lenghts.periodic (
bool
) – If True, returns a window to be used as periodic function. (default:True
) If False, return a symmetric window.alpha (
float
) – The coefficient alpha in the hamming window equation (default:0.54
)beta (
float
) – The coefficient beta in the hamming window equation (default:0.46
)dtype (
Optional
[Union
[Array
,NativeArray
]]) – data type of the returned arrays. (default:None
)out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – The container that includes the Hamming windows.
Examples
>>> x = ivy.Container(a=3, b=5)) >>> x.hamming_window(periodic=True, alpha=0.2, beta=2) { a: ivy.array([-1.8000, 1.2000, 1.2000]), b: ivy.array([-1.8000, -0.4180, 1.8180, 1.8180, -0.4180]) }
- hann_window(periodic=True, dtype=None, *, out=None)[source]#
ivy.Container instance method variant of ivy.hann_window. This method simply wraps the function, and so the docstring for ivy.hann_window also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container with window sizes.periodic (
bool
) – If True, returns a window to be used as periodic function. (default:True
) If False, return a symmetric window.dtype (
Optional
[Union
[Dtype
,NativeDtype
]]) – The data type to produce. Must be a floating point type. (default:None
)out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – The container containing the Hann windows.
Examples
With one
ivy.Container
input:>>> x = ivy.Container(a=3, b=5) >>> ivy.hann_window(x) { a: ivy.array([0.0000, 0.7500, 0.7500]) b: ivy.array([0.0000, 0.3455, 0.9045, 0.9045, 0.3455]) }
- kaiser_bessel_derived_window(periodic=True, beta=12.0, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, dtype=None, out=None)[source]#
ivy.Container instance method variant of ivy.kaiser_bessel_derived_window. This method simply wraps the function, and so the docstring for ivy.kaiser_bessel_derived_window also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container including window lenghts.periodic (
bool
) – If True, returns a periodic window suitable for use in spectral analysis. (default:True
) If False, returns a symmetric window suitable for use in filter design.beta (
float
) – a float used as shape parameter for the window. (default:12.0
)dtype (
Optional
[Union
[Array
,NativeArray
]]) – data type of the returned array. (default:None
)out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – The container that includes the Kaiser Bessel Derived windows.
Examples
>>> x = ivy.Container(a=3, b=5)) >>> x.kaiser_bessel_derived_window(True, 5) { a: ivy.array([0.70710677, 0.70710677]), b: ivy.array([0.18493208, 0.9827513 , 0.9827513 , 0.18493208]), }
- kaiser_window(periodic=True, beta=12.0, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, dtype=None, out=None)[source]#
ivy.Container instance method variant of ivy.kaiser_window. This method simply wraps the function, and so the docstring for ivy.kaiser_window also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container including window lenghts.periodic (
bool
) – If True, returns a periodic window suitable for use in spectral analysis. (default:True
) If False, returns a symmetric window suitable for use in filter design.beta (
float
) – a float used as shape parameter for the window. (default:12.0
)dtype (
Optional
[Union
[Array
,NativeArray
]]) – data type of the returned array. (default:None
)out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – The container that includes the Kaiser windows.
Examples
>>> x = ivy.Container(a=3, b=5) >>> ivy.Container.static_kaiser_window(x, True, 5) { a: ivy.array([0.2049, 0.8712, 0.8712]), a: ivy.array([0.0367, 0.7753, 0.7753]), }
- static static_eye_like(x, /, k=0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, *, out=None, dtype=None, device=None)[source]#
ivy.Container static method variant of ivy.eye_like. This method simply wraps the function, and so the docstring for ivy.eye_like also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input array or container from which to derive the output container shape.k (
int
) – index of the diagonal. A positive value refers to an upper diagonal, (default:0
) a negative value to a lower diagonal, and 0 to the main diagonal. Default:0
.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.dtype (
Optional
[Union
[Dtype
,NativeDtype
]]) – output array data type. Ifdtype
isNone
, the output container (default:None
) data type must be inferred fromself
. DefaultNone
.device (
Optional
[Union
[Device
,NativeDevice
]]) – device on which to place the created array. If device isNone
, the (default:None
) output container device must be inferred fromself
. Default:None
.out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a (default:None
) shape that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – a container having the same shape as
x
and filled withones
in diagonalk
andzeros
elsewhere.
Examples
>>> x = ivy.Container(a=ivy.array([0., 2.6, -3.5]), b=ivy.array([4.5, -5.3, -0, -2.3])) >>> y = ivy.Container.static_eye_like(x) >>> print(y) { a: ivy.array([[1.]]), b: ivy.array([[1.]]) }
- static static_hamming_window(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, periodic=True, alpha=0.54, beta=0.46, dtype=None, out=None)[source]#
ivy.Container static method variant of ivy.hamming_window. This method simply wraps the function, and so the docstring for ivy.hamming_window also applies to this method with minimal changes.
- Parameters:
x (
Union
[int
,Array
,NativeArray
,Container
]) – input container including window lenghts.periodic (
bool
) – If True, returns a window to be used as periodic function. (default:True
) If False, return a symmetric window.alpha (
float
) – The coefficient alpha in the hamming window equation (default:0.54
)beta (
float
) – The coefficient beta in the hamming window equation (default:0.46
)dtype (
Optional
[Union
[Array
,NativeArray
]]) – data type of the returned arrays. (default:None
)out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – The container that includes the Hamming windows.
Examples
>>> x = ivy.Container(a=3, b=5) >>> ivy.Container.static_hamming_window(x, periodic=True, alpha=0.2, beta=2) { a: ivy.array([-1.8000, 1.2000, 1.2000]), b: ivy.array([-1.8000, -0.4180, 1.8180, 1.8180, -0.4180]) }
- static static_hann_window(window_length, periodic=True, dtype=None, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.hann_window. This method simply wraps the function, and so the docstring for ivy.hann_window also applies to this method with minimal changes.
- Parameters:
window_length (
Union
[int
,Container
]) – container including multiple window sizes.periodic (
bool
) – If True, returns a window to be used as periodic function. (default:True
) If False, return a symmetric window.dtype (
Optional
[Union
[Dtype
,NativeDtype
]]) – The data type to produce. Must be a floating point type. (default:None
)out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – The container that contains the Hann windows.
Examples
With one
ivy.Container
input:>>> x = ivy.Container(a=3, b=5) >>> ivy.Container.static_hann(x) { a: ivy.array([0.0000, 0.7500, 0.7500]) b: ivy.array([0.0000, 0.3455, 0.9045, 0.9045, 0.3455]) }
- static static_kaiser_bessel_derived_window(x, periodic=True, beta=12.0, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, dtype=None, out=None)[source]#
ivy.Container static method variant of ivy.kaiser_bessel_derived_window. This method simply wraps the function, and so the docstring for ivy.kaiser_bessel_derived_window also applies to this method with minimal changes.
- Parameters:
x (
Union
[int
,Array
,NativeArray
,Container
]) – input container including window lenghts.periodic (
bool
) – If True, returns a periodic window suitable for use in spectral analysis. (default:True
) If False, returns a symmetric window suitable for use in filter design.beta (
float
) – a float used as shape parameter for the window. (default:12.0
)dtype (
Optional
[Union
[Array
,NativeArray
]]) – data type of the returned array. (default:None
)out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – The container that includes the Kaiser Bessel Derived windows.
Examples
>>> x = ivy.Container(a=3, b=5) >>> ivy.Container.static_kaiser_bessel_derived_window(x, True, 5) { a: ivy.array([0.70710677, 0.70710677]), b: ivy.array([0.18493208, 0.9827513 , 0.9827513 , 0.18493208]), }
- static static_kaiser_window(window_length, periodic=True, beta=12.0, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, dtype=None, out=None)[source]#
ivy.Container static method variant of ivy.kaiser_window. This method simply wraps the function, and so the docstring for ivy.kaiser_window also applies to this method with minimal changes.
- Parameters:
window_length (
Union
[int
,Container
]) – input container including window lenghts.periodic (
bool
) – If True, returns a periodic window suitable for use in spectral analysis. (default:True
) If False, returns a symmetric window suitable for use in filter design.beta (
float
) – a float used as shape parameter for the window. (default:12.0
)dtype (
Optional
[Union
[Array
,NativeArray
]]) – data type of the returned array. (default:None
)out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – The container that includes the Kaiser windows.
Examples
>>> x = ivy.Container(a=3, b=5) >>> ivy.Container.static_kaiser_window(x, True, 5) { a: ivy.array([0.2049, 0.8712, 0.8712]), a: ivy.array([0.0367, 0.7753, 0.7753]), }
- static static_tril_indices(n_rows, n_cols=None, k=0, /, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, *, device=None)[source]#
- Return type:
Container
- static static_vorbis_window(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, dtype=None, out=None)[source]#
ivy.Container static method variant of ivy.vorbis_window. This method simply wraps the function, and so the docstring for ivy.vorbis_window also applies to this method with minimal changes.
- Parameters:
x (
Union
[int
,Array
,NativeArray
,Container
]) – input container including window lenghts.dtype (
Optional
[Union
[Array
,NativeArray
]]) – data type of the returned arrays. (default:None
)out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – The container that includes the vorbis windows.
Examples
>>> x = ivy.Container(a=3, b=5) >>> ivy.Container.static_vorbis_window(x) { a: ivy.array([0., 0.38268343, 0.92387953, 1., 0.92387953, 0.38268343]), b: ivy.array([0., 0.14943586, 0.51644717, 0.85631905, 0.98877142, 1., 0.98877142, 0.85631905, 0.51644717, 0.14943586]) }
- tril_indices(n_rows, n_cols=None, k=0, /, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, *, device=None)[source]#
- Return type:
Container
- vorbis_window(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, dtype=None, out=None)[source]#
ivy.Container instance method variant of ivy.vorbis_window. This method simply wraps the function, and so the docstring for ivy.vorbis_window also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container including window lenghts.dtype (
Optional
[Union
[Array
,NativeArray
]]) – data type of the returned arrays. (default:None
)out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – The container that includes the vorbis windows.
Examples
>>> x = ivy.Container(a=3, b=5)) >>> x.vorbis_window() { a: ivy.array([0., 0.38268343, 0.92387953, 1., 0.92387953, 0.38268343]), b: ivy.array([0., 0.14943586, 0.51644717, 0.85631905, 0.98877142, 1., 0.98877142, 0.85631905, 0.51644717, 0.14943586]) }
- class ivy.data_classes.container.experimental.data_type._ContainerWithData_typeExperimental(dict_in=None, queues=None, queue_load_sizes=None, container_combine_method='list_join', queue_timeout=None, print_limit=10, key_length_limit=None, print_indent=4, print_line_spacing=0, ivyh=None, default_key_color='green', keyword_color_dict=None, rebuild_child_containers=False, types_to_iteratively_nest=None, alphabetical_keys=True, dynamic_backend=None, **kwargs)[source]#
- _abc_impl = <_abc_data object>#
- class ivy.data_classes.container.experimental.device._ContainerWithDeviceExperimental(dict_in=None, queues=None, queue_load_sizes=None, container_combine_method='list_join', queue_timeout=None, print_limit=10, key_length_limit=None, print_indent=4, print_line_spacing=0, ivyh=None, default_key_color='green', keyword_color_dict=None, rebuild_child_containers=False, types_to_iteratively_nest=None, alphabetical_keys=True, dynamic_backend=None, **kwargs)[source]#
- _abc_impl = <_abc_data object>#
- class ivy.data_classes.container.experimental.elementwise._ContainerWithElementWiseExperimental(dict_in=None, queues=None, queue_load_sizes=None, container_combine_method='list_join', queue_timeout=None, print_limit=10, key_length_limit=None, print_indent=4, print_line_spacing=0, ivyh=None, default_key_color='green', keyword_color_dict=None, rebuild_child_containers=False, types_to_iteratively_nest=None, alphabetical_keys=True, dynamic_backend=None, **kwargs)[source]#
- _abc_impl = <_abc_data object>#
- allclose(x2, /, *, rtol=1e-05, atol=1e-08, equal_nan=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.allclose. This method simply wraps the function, and so the docstring for ivy.allclose also applies to this method with minimal changes.
- Parameters:
self (
Container
) – Input container containing first input array.x2 (
Container
) – Input container containing second input array.rtol (
float
) – The relative tolerance parameter. (default:1e-05
)atol (
float
) – The absolute tolerance parameter. (default:1e-08
)equal_nan (
bool
) – Whether to compare NaN’s as equal. If True, NaN’s in x1 will be (default:False
) considered equal to NaN’s in x2 in the output array.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – Alternate output array in which to place the result. (default:None
) The default is None.
- Return type:
Container
- Returns:
ret – A new container holding the result is returned unless out is specified, in which it is returned.
Examples
>>> x1 = ivy.Container(a=ivy.array([1., 2., 3.]), b=ivy.array([1., 2., 3.])) >>> x2 = ivy.Container(a=ivy.array([1., 2., 3.]), b=ivy.array([1., 2., 3.])) >>> y = x1.allclose(x2) >>> print(y) { a: ivy.array(True), b: ivy.array(True) }
>>> x1 = ivy.Container(a=ivy.array([1., 2., 3.]), ... b=ivy.array([1., 2., 3.])) >>> x2 = ivy.Container(a=ivy.array([1., 2., 3.0003]), ... b=ivy.array([1.0006, 2., 3.])) >>> y = x1.allclose(x2, rtol=1e-3) >>> print(y) { a: ivy.array(True), b: ivy.array(True) }
- binarizer(*, threshold=0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
Map the values of the input tensor to either 0 or 1, element-wise, based on the outcome of a comparison against a threshold value.
- Parameters:
threshold (
float
) – Values greater than this are (default:0
) mapped to 1, others to 0.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The keychains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – Binarized output data
- conj(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.conj. This method simply wraps the function, and so the docstring for ivy.conj also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – a container containing output array(s) of the same dtype as the input array(s) with the complex conjugates of the complex values present in the input array. If x is a container of scalar(s) then a container of scalar(s) will be returned.
Examples
>>> x = ivy.Container(a=ivy.array([-1j, 0.335+2.345j, 1.23+7j]), b=ivy.array([0.0, 1.2+3.3j, 1+0j])) >>> x.conj() { a: ivy.array([1j, 0.335-2345j, 1.23-7j]), b: ivy.array([0.0, 1.2-3.3j, 1-0j]) }
- copysign(x2, /, *, out=None)[source]#
ivy.Container instance method variant of ivy.copysign. This method simply wraps the function, and so the docstring for ivy.copysign also applies to this method with minimal changes.
- Parameters:
self (
Container
) – Container to change the sign ofx2 (
Container
) – Container from which the new signs are applied Unsigned zeroes are considered positive.out (
Optional
[Container
]) – optional output Container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – x1 with the signs of x2. This is a scalar if both x1 and x2 are scalars.
Examples
>>> x1 = ivy.Container(a=ivy.array([0,1,2]), b=ivy.array(-1)) >>> x2 = ivy.Container(a=-1, b=ivy.array(10)) >>> x1.copysign(x2) { a: ivy.array([-0., -1., -2.]), b: ivy.array(1.) } >>> x1.copysign(-1) { a: ivy.array([-0., -1., -2.]), b: ivy.array(-1.) }
- count_nonzero(*, axis=None, keepdims=False, dtype=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.count_nonzero. This method simply wraps the function, and so the docstring for ivy.count_nonzero also applies to this method with minimal changes.
- Parameters:
self (
Container
) – container with the base input arrays.axis (
Optional
[Union
[int
,Tuple
[int
,...
]]]) – optional axis or tuple of axes along which to count non-zeros. Default is (default:None
) None, meaning that non-zeros will be counted along a flattened version of the input array.keepdims (
bool
) – optional, if this is set to True, the axes that are counted are left in the (default:False
) result as dimensions with size one. With this option, the result will broadcast correctly against the input array.dtype (
Optional
[Union
[Dtype
,NativeDtype
]]) – optional output dtype. Default is of type integer. (default:None
)key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – Container including number of non-zero values in the array along a given axis. Otherwise, container with the total number of non-zero values in the array is returned.
Examples
>>> x = ivy.Container(a=ivy.array([[0, 1, 2, 3],[4, 5, 6, 7]]), b=ivy.array([[[0,1],[2,3]],[[4,5],[6,7]]])) >>> x.count_nonzero() { a: ivy.array(7), b: ivy.array(7) } >>> x = ivy.Container(a=ivy.array([[0, 1, 2, 3],[4, 5, 6, 7]]), b=ivy.array([[[0,1],[2,3]],[[4,5],[6,7]]])) >>> x.count_nonzero(axis=0) { a: ivy.array([1, 2, 2, 2]), b: ivy.array([[1, 2], [2, 2]]) } >>> x = ivy.Container(a=ivy.array([[0, 1, 2, 3],[4, 5, 6, 7]]), b=ivy.array([[[0,1],[2,3]],[[4,5],[6,7]]])) >>> x.count_nonzero(axis=(0,1), keepdims=True) { a: ivy.array([[7]]), b: ivy.array([[[3, 4]]]) }
- diff(*, n=1, axis=-1, prepend=None, append=None, out=None)[source]#
ivy.Container instance method variant of ivy.diff. This method simply wraps the function, and so the docstring for ivy.diff also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container with array-like items.n (
int
) – The number of times values are differenced. If zero, the input is returned (default:1
) as-is.axis (
int
) – The axis along which the difference is taken, default is the last axis. (default:-1
)prepend (
Optional
[Union
[Array
,NativeArray
,int
,list
,tuple
]]) – Values to prepend/append to x along given axis prior to performing the (default:None
) 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
]]) – Values to prepend/append to x along given axis prior to performing the (default:None
) 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
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – Container including arrays with the n-th discrete difference along the given axis.
Examples
>>> x = ivy.Container(a=ivy.array([1, 2, 4, 7, 0]), b=ivy.array([1, 2, 4, 7, 0])) >>> x.diff() { a: ivy.array([1, 2, 3, -7]), b: ivy.array([1, 2, 3, -7]) }
- fix(*, out=None)[source]#
ivy.Container instance method variant of ivy.fix. This method simply wraps the function, and so the docstring for ivy.fix also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container with array items.out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – Container including arrays with element-wise rounding of input arrays elements.
Examples
>>> x = ivy.Container(a=ivy.array([2.1, 2.9, -2.1]), b=ivy.array([3.14])) >>> x.fix() { a: ivy.array([ 2., 2., -2.]) b: ivy.array([ 3.0 ]) }
- float_power(x2, /, *, out=None)[source]#
ivy.Container instance method variant of ivy.float_power. This method simply wraps the function, and so the docstring for ivy.float_power also applies to this method with minimal changes.
- Parameters:
self (
Container
) – container with the base input arrays.x2 (
Container
) – container with the exponent input arraysout (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – Container including arrays with base arrays raised to the powers of exponents arrays, element-wise .
Examples
>>> x1 = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([2, 10])) >>> x2 = ivy.Container(a=ivy.array([1, 3, 1]), b=0) >>> x1.float_power(x2) { a: ivy.array([1, 8, 3]) b: ivy.array([1, 1]) }
- fmax(x2, /, *, out=None)[source]#
ivy.Container instance method variant of ivy.fmax. This method simply wraps the function, and so the docstring for ivy.fmax also applies to this method with minimal changes.
- Parameters:
self (
Container
) – container with the first input arrays.x2 (
Container
) – container with the second input arraysout (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – Container including arrays with element-wise maximums.
Examples
>>> x1 = ivy.Container(a=ivy.array([2, 3, 4]), b=ivy.array([ivy.nan, 0, ivy.nan])) >>> x2 = ivy.Container(a=ivy.array([1, 5, 2]), b=ivy.array([0, ivy.nan, ivy.nan])) >>> x1.fmax(x2) { a: ivy.array([ 2., 5., 4.]) b: ivy.array([ 0, 0, nan]) }
- fmod(x2, /, *, out=None)[source]#
ivy.Container instance method variant of ivy.fmod. This method simply wraps the function, and so the docstring for ivy.fmod also applies to this method with minimal changes.
- Parameters:
self (
Container
) – container with the first input arrays.x2 (
Container
) – container with the second input arraysout (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – Container including arrays with element-wise remainder of divisions.
Examples
>>> x1 = ivy.Container(a=ivy.array([2, 3, 4]), b=ivy.array([ivy.nan, 0, ivy.nan])) >>> x2 = ivy.Container(a=ivy.array([1, 5, 2]), b=ivy.array([0, ivy.nan, ivy.nan])) >>> x1.fmod(x2) { a: ivy.array([ 0, 3, 0]) b: ivy.array([ nan, nan, nan]) }
- frexp(*, out=None)[source]#
ivy.Container instance method variant of ivy.frexp. This method simply wraps the function, and so the docstring for ivy.frexp also applies to this method with minimal changes.
- Parameters:
self (
Container
) – The container whose arrays should be split into mantissa and exponent.out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – container including the mantissa and exponent of x.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([1, 5, 10])) >>> x.frexp() {a: (ivy.array([0.5, 0.5, 0.75]), ivy.array([1, 1, 2])), b: (ivy.array([0.5, 0.625, 0.625]), ivy.array([1, 3, 4]))
}
- gradient(*, spacing=1, edge_order=1, axis=None)[source]#
Calculate gradient of x with respect to (w.r.t.) spacing.
- Parameters:
x – input array representing outcomes of the function spacing if not given, indices of x will be used if scalar indices of x will be scaled with this value if array gradient of x w.r.t. spacing
edge_order (
int
) – 1 or 2, for ‘frist order’ and ‘second order’ estimation (default:1
) of boundary values of gradient respectively.axis (
Optional
[Union
[int
,list
,tuple
]]) – dimension(s) to approximate the gradient over. (default:None
) By default, partial gradient is computed in every dimension
- Return type:
Container
- Returns:
ret – Array with values computed from gradient function from inputs
Examples
>>> coordinates = ivy.Container( >>> a=(ivy.array([-2., -1., 1., 4.]),), >>> b=(ivy.array([2., 1., -1., -4.]),) >>> ) >>> values = ivy.Container( >>> a=ivy.array([4., 1., 1., 16.]), >>> b=ivy.array([4., 1., 1., 16.]) >>> ) >>> ivy.gradient(values, spacing=coordinates) { a: ivy.array([-3., -2., 2., 5.]), b: ivy.array([3., 2., -2., -5.]) }
>>> values = ivy.Container( >>> a=ivy.array([[1, 2, 4, 8], [10, 20, 40, 80]]), >>> b=ivy.array([[-1, -2, -4, -8], [-10, -20, -40, -80]]) >>> ) >>> ivy.gradient(values) [{ a: ivy.array([[9., 18., 36., 72.], [9., 18., 36., 72.]]), b: ivy.array([[-9., -18., -36., -72.], [-9., -18., -36., -72.]]) }, { a: ivy.array([[1., 1.5, 3., 4.], [10., 15., 30., 40.]]), b: ivy.array([[-1., -1.5, -3., -4.], [-10., -15., -30., -40.]]) }]
>>> values = ivy.Container( >>> a=ivy.array([[1, 2, 4, 8], [10, 20, 40, 80]]), >>> b=ivy.array([[-1, -2, -4, -8], [-10, -20, -40, -80]]) >>> ) >>> ivy.gradient(values, spacing=2.0) [{ a: ivy.array([[4.5, 9., 18., 36.], [4.5, 9., 18., 36.]]), b: ivy.array([[-4.5, -9., -18., -36.], [-4.5, -9., -18., -36.]]) }, { a: ivy.array([[0.5, 0.75, 1.5, 2.], [5., 7.5, 15., 20.]]), b: ivy.array([[-0.5, -0.75, -1.5, -2.], [-5., -7.5, -15., -20.]]) }]
>>> values = ivy.Container( >>> a=ivy.array([[1, 2, 4, 8], [10, 20, 40, 80]]), >>> b=ivy.array([[-1, -2, -4, -8], [-10, -20, -40, -80]]) >>> ) >>> ivy.gradient(values, axis=1) { a: ivy.array([[1., 1.5, 3., 4.], [10., 15., 30., 40.]]), b: ivy.array([[-1., -1.5, -3., -4.], [-10., -15., -30., -40.]]) }
>>> values = ivy.Container( >>> a=ivy.array([[1, 2, 4, 8], [10, 20, 40, 80]]), >>> b=ivy.array([[-1, -2, -4, -8], [-10, -20, -40, -80]]) >>> ) >>> ivy.gradient(values, spacing = [3., 2.]) [{ a: ivy.array([[3., 6., 12., 24.], [3., 6., 12., 24.]]), b: ivy.array([[-3., -6., -12., -24.], [-3., -6., -12., -24.]]) }, { a: ivy.array([[0.5, 0.75, 1.5, 2.], [5., 7.5, 15., 20.]]), b: ivy.array([[-0.5, -0.75, -1.5, -2.], [-5., -7.5, -15., -20.]]) }]
>>> coords = ivy.Container( >>> a=(ivy.array([0, 2]), ivy.array([0, 3, 6, 9])), >>> b=(ivy.array([0, -2]), ivy.array([0, -3, -6, -9])) >>>) >>> values = ivy.Container( >>> a=ivy.array([[1, 2, 4, 8], [10, 20, 40, 80]]), >>> b=ivy.array([[-1, -2, -4, -8], [-10, -20, -40, -80]]) >>>) >>> ivy.gradient(values, spacing = coords) [{ a: ivy.array([[4.5, 9., 18., 36.], [4.5, 9., 18., 36.]]), b: ivy.array([[4.5, 9., 18., 36.], [4.5, 9., 18., 36.]]) }, { a: ivy.array([[0.33333333, 0.5, 1., 1.33333333], [3.33333333, 5., 10., 13.33333333]]), b: ivy.array([[0.33333333, 0.5, 1., 1.33333333], [3.33333333, 5., 10., 13.33333333]]) }]
- hypot(x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.hypot. This method simply wraps the function, and so the docstring for ivy.hypot also applies to this method with minimal changes.
- Parameters:
self (
Container
) – Input container containing first input array.x2 (
Container
) – Input container containing second input array.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – Alternate output array in which to place the result. (default:None
) The default is None.
- Return type:
Container
- Returns:
ret – container including the hypot function computed element-wise
Examples
>>> x = ivy.Container(a=ivy.array([2.0]), ... b=ivy.array([3.0])) >>> y = ivy.Container(a=ivy.array([3.0]), b=ivy.array([4.0])) >>> x.hypot(y) { a: ivy.array([3.6055]), b: ivy.array([5.]) }
- isclose(b, /, *, rtol=1e-05, atol=1e-08, equal_nan=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.isclose. This method simply wraps the function, and so the docstring for ivy.isclose also applies to this method with minimal changes.
- Parameters:
self (
Container
) – Input container containing first input array.b (
Container
) – Input container containing second input array.rtol (
float
) – The relative tolerance parameter. (default:1e-05
)atol (
float
) – The absolute tolerance parameter. (default:1e-08
)equal_nan (
bool
) – Whether to compare NaN’s as equal. If True, NaN’s in a will be (default:False
) considered equal to NaN’s in b in the output array.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – Alternate output array in which to place the result. (default:None
) The default is None.
- Return type:
Container
- Returns:
ret – A new array holding the result is returned unless out is specified, in which it is returned.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=ivy.array([1.0, ivy.nan]), b=ivy.array([1.0, ivy.nan])) >>> y = ivy.Container(a=ivy.array([1.0, ivy.nan]), b=ivy.array([1.0, ivy.nan])) >>> x.isclose(y) {a: ivy.array([True, False]), b: ivy.array([True, False])
} >>> x.isclose(y, equal_nan=True) {
a: ivy.array([True, True]), b: ivy.array([True, True])
} >>> x = ivy.Container(a=ivy.array([1.0, 2.0]), b=ivy.array([1.0, 2.0])) >>> y = ivy.Container(a=ivy.array([1.0, 2.001]), b=ivy.array([1.0, 2.0])) >>> x.isclose(y, atol=0.0) {
a: ivy.array([True, False]), b: ivy.array([True, True])
} >>> x.isclose(y, rtol=0.01, atol=0.0) {
a: ivy.array([True, True]), b: ivy.array([True, True])
}
- ldexp(x2, /, *, out=None)[source]#
ivy.Container instance method variant of ivy.ldexp. This method simply wraps the function, and so the docstring for ivy.ldexp also applies to this method with minimal changes.
- Parameters:
self (
Container
) – The container whose arrays should be multiplied by 2**x2.x2 (
Union
[Array
,NativeArray
,Container
]) – The container whose arrays should be used to multiply x1 by 2**x2.out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – container including x1 * 2**x2.
Examples
With one
ivy.Container
input: >>> x1 = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([1, 5, 10])) >>> x2 = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([1, 5, 10])) >>> x1.ldexp(x2) {a: ivy.array([2, 8, 24]), b: ivy.array([2, 160, 10240])
}
- lerp(end, weight, /, *, out=None)[source]#
ivy.Container instance method variant of ivy.lerp. This method simply wraps the function, and so the docstring for ivy.lerp also applies to this method with minimal changes.
- Parameters:
self (
Container
) – The container whose arrays should be used as parameter: inputend (
Union
[Array
,NativeArray
,Container
]) – The container whose arrays should be used as parameter: endweight (
Union
[Array
,NativeArray
,float
,Container
]) – The container whose arrays or scalar should be used as parameter: weightout (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – container including input + ((end - input) * weight)
Examples
With one
ivy.Container
input: >>> input = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([1, 5, 10])) >>> end = ivy.Container(a=ivy.array([10, 10, 10]), b=ivy.array([20, 20, 20])) >>> weight = ivy.Container(a=ivy.array(0.5), b=ivy.array([0.4, 0.5, 0.6])) >>> input.lerp(end, weight) {a: ivy.array([5.5, 6., 6.5]), b: ivy.array([8.60000038, 12.5, 16.])
}
- nansum(*, axis=None, dtype=None, keepdims=False, out=None)[source]#
ivy.Container instance method variant of ivy.nansum. This method simply wraps the function, and so the docstring for ivy.nansum also applies to this method with minimal changes.
- Parameters:
self (
Container
) – Input container including arrays.axis (
Optional
[Union
[tuple
,int
]]) – Axis or axes along which the sum is computed. (default:None
) The default is to compute the sum of the flattened array.dtype (
Optional
[Union
[Dtype
,NativeDtype
]]) – The type of the returned array and of the accumulator in (default:None
) which the elements are summed. By default, the dtype of input is used.keepdims (
bool
) – If this is set to True, the axes which are reduced are left (default:False
) in the result as dimensions with size one.out (
Optional
[Container
]) – Alternate output array in which to place the result. (default:None
) The default is None.
- Return type:
Container
- Returns:
ret – A new array holding the result is returned unless out is specified, in which it is returned.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=ivy.array([[10, 7, 4], [3, 2, 1]]), b=ivy.array([[1, 4, 2], [ivy.nan, ivy.nan, 0]])) >>> x.nansum(axis=0) {a: ivy.array([13, 9, 5]), b: ivy.array([1., 4., 2.])
} >>> x.nansum(axis=1) {
a: ivy.array([21, 6]), b: ivy.array([7., 0.])
}
- nextafter(x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.nextafter. This method simply wraps the function, and so the docstring for ivy.nextafter also applies to this method with minimal changes.
- Parameters:
self (
Container
) – Input container containing first input array.x2 (
Container
) – Input container containing second input array.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – Alternate output array in which to place the result. (default:None
) The default is None.
- Return type:
Container
- Returns:
ret – container including the next representable values of input container’s arrays, element-wise
Examples
>>> x1 = ivy.Container(a=ivy.array([1.0e-50, 2.0e+50]), ... b=ivy.array([2.0, 1.0]) >>> x2 = ivy.Container(a=ivy.array([5.5e-30]), ... b=ivy.array([-2.0])) >>> x1.nextafter(x2) { a: ivy.array([1.4013e-45., 3.4028e+38]), b: ivy.array([5.5e-30]) }
- signbit(*, out=None)[source]#
ivy.Container instance method variant of ivy.signbit. This method simply wraps the function, and so the docstring for ivy.signbit also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container with array-like items.out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – Container including arrays with element-wise signbit of input arrays.
Examples
>>> x = ivy.Container(a=ivy.array([1, -2, 3]), b=-5) >>> x.signbit() { a: ivy.array([False, True, False]) b: ivy.array([True]) }
- sinc(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.sinc. This method simply wraps the function, and so the docstring for ivy.sinc also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container whose elements are each expressed in radians. Should have a floating-point data type.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – a container containing the sinc of each element in
self
. The returned container must have a floating-point data type determined by type-promotion.
Examples
>>> x = ivy.Container(a=ivy.array([0.5, 1.5, 2.5]), ... b=ivy.array([3.5, 4.5, 5.5])) >>> y = x.sinc() >>> print(y) { a: ivy.array([0.637,-0.212,0.127]), b: ivy.array([-0.0909,0.0707,-0.0579]) }
- static static_allclose(x1, x2, /, *, rtol=1e-05, atol=1e-08, equal_nan=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.allclose. This method simply wraps the function, and so the docstring for ivy.allclose also applies to this method with minimal changes.
- Parameters:
x1 (
Union
[Container
,Array
,NativeArray
]) – Input container containing first input array.x2 (
Union
[Container
,Array
,NativeArray
]) – Input container containing second input array.rtol (
float
) – The relative tolerance parameter. (default:1e-05
)atol (
float
) – The absolute tolerance parameter. (default:1e-08
)equal_nan (
bool
) – Whether to compare NaN’s as equal. If True, NaN’s in x1 will be (default:False
) considered equal to NaN’s in x2 in the output array.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Array
]) – Alternate output array in which to place the result. (default:None
) The default is None.
- Return type:
Container
- Returns:
ret – A new container holding the result is returned unless out is specified, in which it is returned.
Examples
>>> x1 = ivy.Container(a=ivy.array([1., 2., 3.]), ... b=ivy.array([1., 2., 3.])) >>> x2 = ivy.Container(a=ivy.array([1., 2., 3.]), ... b=ivy.array([1., 2., 3.])) >>> y = ivy.Container.static_allclose(x1, x2) >>> print(y) { a: ivy.array(True), b: ivy.array(True) }
>>> x1 = ivy.Container(a=ivy.array([1., 2., 3.]), ... b=ivy.array([1., 2., 3.])) >>> x2 = ivy.Container(a=ivy.array([1., 2., 3.0003]), ... b=ivy.array([1.0006, 2., 3.])) >>> y = ivy.Container.static_allclose(x1, x2, rtol=1e-3) >>> print(y) { a: ivy.array(True), b: ivy.array(True) }
- static static_binarizer(x, /, *, threshold=0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
Map the values of the input tensor to either 0 or 1, element-wise, based on the outcome of a comparison against a threshold value.
- Parameters:
self – input container. Should have a real-valued floating-point data type.
threshold (
float
) – Values greater than this are (default:0
) mapped to 1, others to 0.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – Binarized output data
- static static_conj(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.conj. This method simply wraps the function, and so the docstring for ivy.conj also applies to this method with minimal changes.
- Parameters:
x (
Union
[Container
,Array
,NativeArray
]) – input container.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – a container containing output array(s) of the same dtype as the input array(s) with the complex conjugates of the complex values present in the input array. If x is a container of scalar(s) then a container of scalar(s) will be returned.
Examples
>>> x = ivy.Container(a=ivy.array([-1+5j, 0-0j, 1.23j]), ... b=ivy.array([7.9, 0.31+3.3j, -4.2-5.9j])) >>> z = ivy.Container.static_conj(x) >>> print(z) { a: ivy.array([-1-5j, 0+0j, -1.23j]), b: ivy.array([7.9, 0.31-3.3j, -4.2+5.9j]) }
- static static_copysign(x1, x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.copysign. This method simply wraps the function, and so the docstring for ivy.copysign also applies to this method with minimal changes.
- Parameters:
x1 (
Union
[Array
,NativeArray
,Container
,Number
]) – Container, Array, or scalar to change the sign ofx2 (
Union
[Array
,NativeArray
,Container
,Number
]) – Container, Array, or scalar from which the new signs are applied Unsigned zeroes are considered positive.out (
Optional
[Container
]) – optional output Container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – x1 with the signs of x2. This is a scalar if both x1 and x2 are scalars.
Examples
>>> x1 = ivy.Container(a=ivy.array([0,1,2]), b=ivy.array(-1)) >>> x2 = ivy.Container(a=-1, b=ivy.array(10)) >>> ivy.Container.static_copysign(x1, x2) { a: ivy.array([-0., -1., -2.]), b: ivy.array(1.) } >>> ivy.Container.static_copysign(23, x1) { a: ivy.array([23., 23., 23.]), b: ivy.array(-23.) }
- static static_count_nonzero(a, /, *, axis=None, keepdims=False, dtype=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.count_nonzero. This method simply wraps the function, and so the docstring for ivy.count_nonzero also applies to this method with minimal changes.
- Parameters:
a (
Union
[Array
,NativeArray
,Container
]) – container with the base input arrays.axis (
Optional
[Union
[int
,Tuple
[int
,...
]]]) – optional axis or tuple of axes along which to count non-zeros. Default is (default:None
) None, meaning that non-zeros will be counted along a flattened version of the input array.keepdims (
bool
) – optional, if this is set to True, the axes that are counted are left in the (default:False
) result as dimensions with size one. With this option, the result will broadcast correctly against the input array.dtype (
Optional
[Union
[Dtype
,NativeDtype
]]) – optional output dtype. Default is of type integer. (default:None
)key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default is None. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default is True.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default is False.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). Default is False. (default:False
)out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – Container including number of non-zero values in the array along a given axis. Otherwise, container with the total number of non-zero values in the array is returned.
Examples
>>> x = ivy.Container(a=ivy.array([[0, 1, 2, 3],[4, 5, 6, 7]]), b=ivy.array([[[0,1],[2,3]],[[4,5],[6,7]]])) >>> ivy.Container.static_count_nonzero(x) { a: ivy.array(7), b: ivy.array(7) } >>> x = ivy.Container(a=ivy.array([[0, 1, 2, 3],[4, 5, 6, 7]]), b=ivy.array([[[0,1],[2,3]],[[4,5],[6,7]]])) >>> ivy.Container.static_count_nonzero(x, axis=0) { a: ivy.array([1, 2, 2, 2]), b: ivy.array([[1, 2], [2, 2]]) } >>> x = ivy.Container(a=ivy.array([[0, 1, 2, 3],[4, 5, 6, 7]]), b=ivy.array([[[0,1],[2,3]],[[4,5],[6,7]]])) >>> ivy.Container.static_count_nonzero(x, axis=(0,1), keepdims=True) { a: ivy.array([[7]]), b: ivy.array([[[3, 4]]]) }
- static static_diff(x, /, *, n=1, axis=-1, prepend=None, append=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.diff. This method simply wraps the function, and so the docstring for ivy.diff also applies to this method with minimal changes.
- Parameters:
x (
Union
[Container
,Array
,NativeArray
]) – input container with array-like items.n (
int
) – The number of times values are differenced. If zero, the input is returned (default:1
) as-is.axis (
int
) – The axis along which the difference is taken, default is the last axis. (default:-1
)prepend (
Optional
[Union
[Array
,NativeArray
,int
,list
,tuple
]]) – Values to prepend/append to x along given axis prior to performing the (default:None
) 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
]]) – Values to prepend/append to x along given axis prior to performing the (default:None
) 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
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – Container including arrays with the n-th discrete difference along the given axis.
Examples
>>> x = ivy.Container(a=ivy.array([1, 2, 4, 7, 0]), b=ivy.array([1, 2, 4, 7, 0])) >>> ivy.Container.static_diff(x) { a: ivy.array([ 1, 2, 3, -7]), b: ivy.array([ 1, 2, 3, -7]) }
- static static_fix(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.fix. This method simply wraps the function, and so the docstring for ivy.fix also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – input container with array items.out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – Container including arrays with element-wise rounding of input arrays elements.
Examples
>>> x = ivy.Container(a=ivy.array([2.1, 2.9, -2.1]), b=ivy.array([3.14])) >>> ivy.Container.static_fix(x) { a: ivy.array([ 2., 2., -2.]) b: ivy.array([ 3.0 ]) }
- static static_float_power(x1, x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.float_power. This method simply wraps the function, and so the docstring for ivy.float_power also applies to this method with minimal changes.
- Parameters:
x1 (
Union
[Array
,NativeArray
,Container
,float
,list
,tuple
]) – container with the base input arrays.x2 (
Union
[Array
,NativeArray
,Container
,float
,list
,tuple
]) – container with the exponent input arraysout (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – Container including arrays with base arrays raised to the powers of exponents arrays, element-wise .
Examples
>>> x1 = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([2, 10])) >>> x2 = ivy.Container(a=ivy.array([1, 3, 1]), b=0) >>> ivy.Container.static_float_power(x1, x2) { a: ivy.array([1, 8, 3]) b: ivy.array([1, 1]) }
- static static_fmax(x1, x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.fmax. This method simply wraps the function, and so the docstring for ivy.fmax also applies to this method with minimal changes.
- Parameters:
x1 (
Union
[Array
,NativeArray
,Container
]) – container with the first input arrays.x2 (
Union
[Array
,NativeArray
,Container
]) – container with the second input arraysout (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – Container including arrays with element-wise maximums.
Examples
>>> x1 = ivy.Container(a=ivy.array([2, 3, 4]), b=ivy.array([ivy.nan, 0, ivy.nan])) >>> x2 = ivy.Container(a=ivy.array([1, 5, 2]), b=ivy.array([0, ivy.nan, ivy.nan])) >>> ivy.Container.static_fmax(x1, x2) { a: ivy.array([ 2., 5., 4.]) b: ivy.array([ 0, 0, nan]) }
- static static_fmod(x1, x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.fmod. This method simply wraps the function, and so the docstring for ivy.fmod also applies to this method with minimal changes.
- Parameters:
x1 (
Union
[Array
,NativeArray
,Container
]) – container with the first input arrays.x2 (
Union
[Array
,NativeArray
,Container
]) – container with the second input arraysout (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – Container including arrays with element-wise remainder of divisions.
Examples
>>> x1 = ivy.Container(a=ivy.array([2, 3, 4]), b=ivy.array([ivy.nan, 0, ivy.nan])) >>> x2 = ivy.Container(a=ivy.array([1, 5, 2]), b=ivy.array([0, ivy.nan, ivy.nan])) >>> ivy.Container.static_fmod(x1, x2) { a: ivy.array([ 0, 3, 0]) b: ivy.array([ nan, nan, nan]) }
- static static_frexp(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.frexp. This method simply wraps the function, and so the docstring for ivy.frexp also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – The container whose arrays should be split into mantissa and exponent.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – container including the mantissa and exponent of x.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([1, 5, 10])) >>> ivy.Container.static_frexp(x) {a: (ivy.array([0.5, 0.5, 0.75]), ivy.array([1, 1, 2])), b: (ivy.array([0.5, 0.625, 0.625]), ivy.array([1, 3, 4]))
}
- static static_gradient(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, spacing=1, edge_order=1, axis=None)[source]#
- Return type:
Container
- static static_hypot(x1, x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.hypot. This method simply wraps the function, and so the docstring for ivy.hypot also applies to this method with minimal changes.
- Parameters:
x1 (
Union
[Container
,Array
,NativeArray
]) – Input container containing first input array.x2 (
Union
[Container
,Array
,NativeArray
]) – Input container containing second input array.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Array
]) – Alternate output array in which to place the result. (default:None
) The default is None.
- Return type:
Container
- Returns:
ret – container including the hypot function computed element-wise
Examples
>>> x = ivy.Container(a=ivy.array([2.0]), ... b=ivy.array([3.0])) >>> y = ivy.Container(a=ivy.array([3.0]), b=ivy.array([4.0])) >>> ivy.Container.static_hypot(x, y) { a: ivy.array([3.6055]), b: ivy.array([5.]) }
- static static_isclose(a, b, /, *, rtol=1e-05, atol=1e-08, equal_nan=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.isclose. This method simply wraps the function, and so the docstring for ivy.isclose also applies to this method with minimal changes.
- Parameters:
a (
Union
[Container
,Array
,NativeArray
]) – Input container containing first input array.b (
Union
[Container
,Array
,NativeArray
]) – Input container containing second input array.rtol (
float
) – The relative tolerance parameter. (default:1e-05
)atol (
float
) – The absolute tolerance parameter. (default:1e-08
)equal_nan (
bool
) – Whether to compare NaN’s as equal. If True, NaN’s in a will be (default:False
) considered equal to NaN’s in b in the output array.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Array
]) – Alternate output array in which to place the result. (default:None
) The default is None.
- Return type:
Container
- Returns:
ret – A new array holding the result is returned unless out is specified, in which it is returned.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=ivy.array([1.0, ivy.nan]), b=ivy.array([1.0, ivy.nan])) >>> y = ivy.Container(a=ivy.array([1.0, ivy.nan]), b=ivy.array([1.0, ivy.nan])) >>> ivy.Container.static_isclose(x, y) {a: ivy.array([True, False]), b: ivy.array([True, False])
} >>> ivy.Container.static_isclose(x, y, equal_nan=True) {
a: ivy.array([True, True]), b: ivy.array([True, True])
} >>> x = ivy.Container(a=ivy.array([1.0, 2.0]), b=ivy.array([1.0, 2.0])) >>> y = ivy.Container(a=ivy.array([1.0, 2.001]), b=ivy.array([1.0, 2.0])) >>> ivy.Container.static_isclose(x, y, atol=0.0) {
a: ivy.array([True, False]), b: ivy.array([True, True])
} >>> ivy.Container.static_isclose(x, y, rtol=0.01, atol=0.0) {
a: ivy.array([True, True]), b: ivy.array([True, True])
}
- static static_ldexp(x1, x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.ldexp. This method simply wraps the function, and so the docstring for ivy.ldexp also applies to this method with minimal changes.
- Parameters:
x1 (
Union
[Array
,NativeArray
,Container
]) – The container whose arrays should be multiplied by 2**i.x2 (
Union
[Array
,NativeArray
,Container
]) – The container whose arrays should be used to multiply x by 2**i.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – container including x1 * 2**x2.
Examples
With one
ivy.Container
input: >>> x1 = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([1, 5, 10])) >>> x2 = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([1, 5, 10])) >>> ivy.Container.static_ldexp(x1, x2) {a: ivy.array([2, 8, 24]), b: ivy.array([2, 160, 10240])
}
- static static_lerp(input, end, weight, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.lerp. This method simply wraps the function, and so the docstring for ivy.lerp also applies to this method with minimal changes.
- Parameters:
input (
Union
[Array
,NativeArray
,Container
]) – The container whose arrays should be used as parameter: inputend (
Union
[Array
,NativeArray
,Container
]) – The container whose arrays should be used as parameter: endweight (
Union
[Array
,NativeArray
,float
,Container
]) – The container whose arrays or scalar should be used as parameter: weightkey_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – container including input + ((end - input) * weight)
Examples
With one
ivy.Container
input: >>> input = ivy.Container(a=ivy.array([0., 1., 2.]), b=ivy.array([3., 4., 5.])) >>> end = ivy.array([10.]) >>> weight = 1.1 >>> y = ivy.Container.static_lerp(input, end, weight) >>> print(y) {a: ivy.array([11., 10.90000057, 10.80000019]), b: ivy.array([10.70000076, 10.60000038, 10.5])
} >>> input = ivy.Container(a=ivy.array([10.1, 11.1]), b=ivy.array([10, 11])) >>> end = ivy.Container(a=ivy.array([5])) >>> weight = ivy.Container(a=0.5) >>> y = ivy.Container.static_lerp(input, end, weight) >>> print(y) {
a: ivy.array([7.55000019, 8.05000019]), b: {
a: ivy.array([7.5, 8.])
}
}
- static static_nansum(x, /, *, axis=None, dtype=None, keepdims=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.nansum. This method simply wraps the function, and so the docstring for ivy.nansum also applies to this method with minimal changes.
- Parameters:
x (
Union
[Container
,Array
,NativeArray
]) – Input array.axis (
Optional
[Union
[tuple
,int
]]) – Axis or axes along which the sum is computed. (default:None
) The default is to compute the sum of the flattened array.dtype (
Optional
[Union
[Dtype
,NativeDtype
]]) – The type of the returned array and of the accumulator in (default:None
) which the elements are summed. By default, the dtype of input is used.keepdims (
bool
) – If this is set to True, the axes which are reduced are left (default:False
) in the result as dimensions with size one.out (
Optional
[Array
]) – Alternate output array in which to place the result. (default:None
) The default is None.
- Return type:
Container
- Returns:
ret – A new array holding the result is returned unless out is specified, in which it is returned.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=ivy.array([[10, 7, 4], [3, 2, 1]]), b=ivy.array([[1, 4, 2], [ivy.nan, ivy.nan, 0]])) >>> ivy.Container.static_nansum(x) {a: 27, b: 7.0
} >>> ivy.Container.static_nansum(x, axis=0) {
a: ivy.array([13, 9, 5]), b: ivy.array([1., 4., 2.])
} >>> ivy.Container.static_nansum(x, axis=1) {
a: ivy.array([21, 6]), b: ivy.array([7., 0.])
}
- static static_nextafter(x1, x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.nextafter. This method simply wraps the function, and so the docstring for ivy.nextafter also applies to this method with minimal changes.
- Parameters:
x1 (
Union
[Container
,Array
,NativeArray
]) – Input container containing first input arrays.x2 (
Union
[Container
,Array
,NativeArray
]) – Input container containing second input arrays.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Array
]) – Alternate output array in which to place the result. (default:None
) The default is None.
- Return type:
Container
- Returns:
ret – container including the next representable values of input container’s arrays, element-wise
Examples
>>> x1 = ivy.Container(a=ivy.array([1.0e-50, 2.0e+50]), ... b=ivy.array([2.0, 1.0]) >>> x2 = ivy.Container(a=ivy.array([5.5e-30]), ... b=ivy.array([-2.0])) >>> ivy.Container.static_nextafter(x1, x2) { a: ivy.array([1.4013e-45., 3.4028e+38]), b: ivy.array([5.5e-30]) }
- static static_signbit(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.signbit. This method simply wraps the function, and so the docstring for ivy.signbit also applies to this method with minimal changes.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
,float
,int
,list
,tuple
]) – input container with array-like items.out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – Container including arrays with element-wise signbit of input arrays.
Examples
>>> x = ivy.Container(a=ivy.array([1, -2, 3]), b=-5) >>> ivy.Container.static_signbit(x) { a: ivy.array([False, True, False]) b: ivy.array([True]) }
- static static_sinc(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.sinc. This method simply wraps the function, and so the docstring for ivy.sinc also applies to this method with minimal changes.
- Parameters:
x (
Container
) – input container whose elements are each expressed in radians. Should have a floating-point data type.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – a container containing the sinc of each element in
x
. The returned container must have a floating-point data type determined by type-promotion.
Examples
>>> x = ivy.Container(a=ivy.array([0.5, 1.5, 2.5]), ... b=ivy.array([3.5, 4.5, 5.5])) >>> y = ivy.Container.static_sinc(x) >>> print(y) { a: ivy.array([0.636, -0.212, 0.127]), b: ivy.array([-0.090, 0.070, -0.057]) }
- static static_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
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Array
]) – Alternate output array in which to place the result. (default:None
) The default is None.
- Return type:
Container
- Returns:
ret – container including the next representable values of input container’s arrays, element-wise
Examples
>>> x = ivy.Container(a=ivy.zeros(3)), ... b=ivy.array([1.0, 2.0, 3.0])) >>> y = ivy.Container(a=ivy.array([-1.0, 0.0, 1.0]), ... b=ivy.array([3.0, 2.0, 1.0])) >>> ivy.Container.static_xlogy(x, y) { a: ivy.array([0.0, 0.0, 0.0]), b: ivy.array([1.0986, 1.3863, 0.0000]) }
- static static_zeta(x, q, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.zeta. This method simply wraps the function, and so the docstring for ivy.zeta also applies to this method with minimal changes.
- Parameters:
x (
Union
[Container
,Array
,NativeArray
]) – Input container containing first input arrays.q (
Union
[Container
,Array
,NativeArray
]) – Input container containing second input arrays.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Array
]) – Alternate output array in which to place the result. (default:None
) The default is None.
- Return type:
Container
- Returns:
ret – container including the zeta function computed element-wise
Examples
>>> x = ivy.Container(a=ivy.array([5.0, 3.0]), ... b=ivy.array([2.0, 1.0]) >>> q = ivy.Container(a=ivy.array([2.0]), ... b=ivy.array([5.0])) >>> ivy.Container.static_zeta(x1, x2) { a: ivy.array([0.0369, 0.2021]), b: ivy.array([0.0006, 0.0244]) }
- xlogy(y, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – Alternate output array in which to place the result. (default:None
) The default is None.
- Return type:
Container
- Returns:
ret – container including the next representable values of input container’s arrays, element-wise
Examples
>>> x = ivy.Container(a=ivy.zeros(3)), ... b=ivy.array([1.0, 2.0, 3.0])) >>> y = ivy.Container(a=ivy.array([-1.0, 0.0, 1.0]), ... b=ivy.array([3.0, 2.0, 1.0])) >>> x.xlogy(y) { a: ivy.array([0.0, 0.0, 0.0]), b: ivy.array([1.0986, 1.3863, 0.0000]) }
- zeta(q, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – Alternate output array in which to place the result. (default:None
) The default is None.
- Return type:
Container
- Returns:
ret – container including the zeta function computed element-wise
Examples
>>> x = ivy.Container(a=ivy.array([5.0, 3.0]), ... b=ivy.array([2.0, 1.0]) >>> q = ivy.Container(a=ivy.array([2.0]), ... b=ivy.array([5.0])) >>> x.zeta(q) { a: ivy.array([0.0369, 0.2021]), b: ivy.array([0.0006, 0.0244]) }
- class ivy.data_classes.container.experimental.general._ContainerWithGeneralExperimental(dict_in=None, queues=None, queue_load_sizes=None, container_combine_method='list_join', queue_timeout=None, print_limit=10, key_length_limit=None, print_indent=4, print_line_spacing=0, ivyh=None, default_key_color='green', keyword_color_dict=None, rebuild_child_containers=False, types_to_iteratively_nest=None, alphabetical_keys=True, dynamic_backend=None, **kwargs)[source]#
- _abc_impl = <_abc_data object>#
- static _static_reduce(operand, init_value, computation, /, *, axes=0, keepdims=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
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
]) – The value with which to start the reduction.computation (
Callable
) – The reduction function.axes (
Union
[int
,Sequence
[int
]]) – The dimensions along which the reduction is performed. (default:0
)keepdims (
bool
) – If this is set to True, the axes which are reduced are left in the result as (default:False
) dimensions with size one.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.
- Return type:
Container
- Returns:
ret – The reduced array.
Examples
>>> x = ivy.Container( >>> a=ivy.array([[1, 2, 3], [4, 5, 6]]), >>> b=ivy.native_array([[7, 8, 9], [10, 5, 1]]) >>> ) >>> y = ivy.Container.static_reduce(x, 0, ivy.add) >>> print(y) { a: ivy.array([6, 15]), b: ivy.array([24, 16]) }
- reduce(init_value, computation, /, *, axes=0, keepdims=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
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
]) – The value with which to start the reduction.computation (
Callable
) – The reduction function.axes (
Union
[int
,Sequence
[int
]]) – The dimensions along which the reduction is performed. (default:0
)keepdims (
bool
) – If this is set to True, the axes which are reduced are left in the result as (default:False
) dimensions with size one.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.
- Return type:
Container
- Returns:
ret – The reduced array.
Examples
>>> x = ivy.Container( >>> a=ivy.array([[1, 2, 3], [4, 5, 6]]), >>> b=ivy.native_array([[7, 8, 9], [10, 5, 1]]) >>> ) >>> y = x.reduce(0, ivy.add) >>> print(y) { a: ivy.array([6, 15]), b: ivy.array([24, 16]) }
- class ivy.data_classes.container.experimental.gradients._ContainerWithGradientsExperimental(dict_in=None, queues=None, queue_load_sizes=None, container_combine_method='list_join', queue_timeout=None, print_limit=10, key_length_limit=None, print_indent=4, print_line_spacing=0, ivyh=None, default_key_color='green', keyword_color_dict=None, rebuild_child_containers=False, types_to_iteratively_nest=None, alphabetical_keys=True, dynamic_backend=None, **kwargs)[source]#
- _abc_impl = <_abc_data object>#
- class ivy.data_classes.container.experimental.image._ContainerWithImageExperimental(dict_in=None, queues=None, queue_load_sizes=None, container_combine_method='list_join', queue_timeout=None, print_limit=10, key_length_limit=None, print_indent=4, print_line_spacing=0, ivyh=None, default_key_color='green', keyword_color_dict=None, rebuild_child_containers=False, types_to_iteratively_nest=None, alphabetical_keys=True, dynamic_backend=None, **kwargs)[source]#
- _abc_impl = <_abc_data object>#
- class ivy.data_classes.container.experimental.layers._ContainerWithLayersExperimental(dict_in=None, queues=None, queue_load_sizes=None, container_combine_method='list_join', queue_timeout=None, print_limit=10, key_length_limit=None, print_indent=4, print_line_spacing=0, ivyh=None, default_key_color='green', keyword_color_dict=None, rebuild_child_containers=False, types_to_iteratively_nest=None, alphabetical_keys=True, dynamic_backend=None, **kwargs)[source]#
- _abc_impl = <_abc_data object>#
- static _static_fft(x, dim, /, *, norm='backward', n=None, out=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
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 (
int
) – The dimension along which to take the one dimensional FFT.norm (
str
) – Optional argument, “backward”, “ortho” or “forward”. Defaults to be (default:'backward'
) “backward”. “backward” indicates no normalization. “ortho” indicates normalization by 1/sqrt(n). “forward” indicates normalization by 1/n.n (
Optional
[Union
[int
,Tuple
[int
]]]) – Optional argument indicating the sequence length, if given, the input (default:None
) would be padded with zero or truncated to length n before performing FFT. Should be a integer greater than 1.out (
Optional
[Container
]) – Optional output array, for writing the result to. It must have a shape that (default:None
) the inputs broadcast to.
- Return type:
Container
- Returns:
ret – The transformed input.
Examples
>>> a = ivy.array(np.array([ 6.+0.j, -2.+2.j, -2.+0.j, -2.-2.j])) >>> b = ivy.array(np.exp(2j * np.pi * np.arange(8) / 8)) >>> c = ivy.Container(a=a, b=b) >>> dims = ivy.Container(a=0, b=0) >>> ivy.Container.static_fft(c, dims) { a: ivy.array([0.+0.j, 12.+0.j, 8.+0.j, 4.+0.j]), b: ivy.array([-3.44509285e-16+1.14423775e-17j, 8.00000000e+00-8.11483250e-16j, 2.33486982e-16+1.22464680e-16j, 0.00000000e+00+1.22464680e-16j, 9.95799250e-17+2.33486982e-16j, 0.00000000e+00+7.66951701e-17j, 1.14423775e-17+1.22464680e-16j, 0.00000000e+00+1.22464680e-16j]) }
- adaptive_avg_pool1d(output_size, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
Apply a 1D adaptive average pooling over an input signal composed of several input planes.
- Parameters:
self (
Container
) – Input container.output_size (
int
) – Spatial output size.
- Return type:
Container
- Returns:
The result of the pooling operation.
- adaptive_avg_pool2d(output_size, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
Apply a 2D adaptive average pooling over an input signal composed of several input planes.
- Parameters:
self (
Container
) – Input container.output_size (
int
) – Spatial output size.
- Return type:
Container
- Returns:
The result of the pooling operation.
- avg_pool1d(kernel, strides, padding, /, *, data_format='NWC', count_include_pad=False, ceil_mode=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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
]]) – Size of the kernel i.e., the sliding window for each dimension of input. [w].strides (
Union
[int
,Tuple
[int
]]) – The stride of the sliding window for each dimension of input.padding (
str
) – SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.data_format (
str
) – NWC” or “NCW”. Defaults to “NWC”. (default:'NWC'
)count_include_pad (
bool
) – Whether to include padding in the averaging calculation. (default:False
)ceil_mode (
bool
) – Whether to use ceil or floor for creating the output shape. (default:False
)out (
Optional
[Container
]) – optional output array, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – The result of the pooling operation.
Examples
>>> a = ivy.arange(12.).reshape((2,2,3)) >>> b = ivy.arange(24.).reshape((2,3,4)) >>> x = ivy.Container({'a': a, 'b': b}) >>> print(x.avg_pool1d(2, 2, "VALID")) { a: ivy.array([[[1.5, 2.5, 3.5]], [[7.5, 8.5, 9.5]]]), b: ivy.array([[[2., 3., 4., 5.]], [[14., 15., 16., 17.]]]) }
- avg_pool2d(kernel, strides, padding, /, *, data_format='NHWC', count_include_pad=False, ceil_mode=False, divisor_override=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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
]]) – The size of the window to take a max over.strides (
Union
[int
,Tuple
[int
],Tuple
[int
,int
]]) – The stride of the sliding window for each dimension of input.padding (
str
) – “SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.data_format (
str
) – “NHWC” or “NCHW”. Defaults to “NHWC”. (default:'NHWC'
)count_include_pad (
bool
) – Whether to include padding in the averaging calculation. (default:False
)ceil_mode (
bool
) – Whether to use ceil or floor for creating the output shape. (default:False
)divisor_override (
Optional
[int
]) – If specified, it will be used as divisor, (default:None
) otherwise kernel_size will be used.out (
Optional
[Container
]) – optional output array, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – The result of the pooling operation.
Examples
>>> a = ivy.arange(12).reshape((2, 1, 3, 2)) >>> b = ivy.arange(48).reshape((2, 4, 3, 2)) >>> x = ivy.Container({'a': a, 'b': b}) >>> print(x.avg_pool2d((2, 2), (1, 1), "SAME")) { a: (<class ivy.array.array.Array> shape=[2, 1, 3, 2]), b: (<class ivy.array.array.Array> shape=[2, 4, 3, 2]) }
- avg_pool3d(kernel, strides, padding, /, *, data_format='NDHWC', count_include_pad=False, ceil_mode=False, divisor_override=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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 – Input volume [batch_size,d,h,w,d_in].
kernel (
Union
[int
,Tuple
[int
],Tuple
[int
,int
,int
]]) – Convolution filters [d,h,w].strides (
Union
[int
,Tuple
[int
],Tuple
[int
,int
,int
]]) – The stride of the sliding window for each dimension of input.padding (
str
) – SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.data_format (
str
) – NDHWC” or “NCDHW”. Defaults to “NDHWC”. (default:'NDHWC'
)count_include_pad (
bool
) – Whether to include padding in the averaging calculation. (default:False
)ceil_mode (
bool
) – Whether to use ceil or floor for creating the output shape. (default:False
)divisor_override (
Optional
[int
]) – If specified, it will be used as the divisor, otherwise (default:None
)out (
Optional
[Container
]) – optional output array, for writing the result to. It must (default:None
) have a shape that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – The result of the pooling operation.
Examples
>>> a = ivy.arange(12).reshape((1, 2, 1, 3, 2)) >>> b = ivy.arange(48).reshape((2, 2, 2, 3, 2)) >>> x = ivy.Container({'a': a, 'b': b}) >>> print(x.max_pool3d(2, 1, "VALID")) { a: ivy.array([], shape=(1, 1, 0, 2, 2)), b: ivy.array([[[[[20, 21], [22, 23]]]], [[[[44, 45], [46, 47]]]]]) }
- dct(*, type=2, n=None, axis=-1, norm=None, out=None)[source]#
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 (
Literal
[1, 2, 3, 4]) – The type of the dct. Must be 1, 2, 3 or 4. (default:2
)n (
Optional
[int
]) – The lenght of the transform. If n is less than the input signal lenght, (default:None
) then x is truncated, if n is larger then x is zero-padded.norm (
Optional
[Literal
[‘ortho’]]) – The type of normalization to be applied. Must be either None or “ortho”. (default:None
)out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – The transformed input.
Examples
>>> x = ivy.Container(a=ivy.array([8, 16, 24, 32, 40, 48, 56, 64]), ... b=ivy.array([1, 2, 3, 4, 5, 6, 7, 8])) >>> x.dct(type=2, norm='ortho') { a: ivy.array([102., -51.5, 0., -5.39, 0., -1.61, 0., -0.406]), b: ivy.array([12.7, -6.44, 0., -0.673, 0., -0.201, 0., -0.0507]) }
- dft(*, axis=1, inverse=False, onesided=False, dft_length=None, norm='backward', key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
- Parameters:
axis (
int
) – (default:1
)inverse (
bool
) – (default:False
)onesided (
bool
) – (default:False
)dft_length (
Optional
[Union
[int
,Tuple
[int
]]]) – (default:None
)norm (
str
) – (default:'backward'
)key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – (default:None
)to_apply (
bool
) – (default:True
)prune_unapplied (
bool
) – (default:False
)map_sequences (
bool
) – (default:False
)out (
Optional
[Array
]) – (default:None
)
- Return type:
Container
- embedding(indices, /, *, max_norm=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
- Return type:
Container
- fft(dim, /, *, norm='backward', n=None, out=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
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 (
int
) – The dimension along which to take the one dimensional FFT.norm (
str
) – Optional argument, “backward”, “ortho” or “forward”. Defaults to be (default:'backward'
) “backward”. “backward” indicates no normalization. “ortho” indicates normalization by 1/sqrt(n). “forward” indicates normalization by 1/n.n (
Optional
[Union
[int
,Tuple
[int
]]]) – Optional argument indicating the sequence length, if given, the input would (default:None
) be padded with zero or truncated to length n before performing FFT. Should be a integer greater than 1.out (
Optional
[Array
]) – Optional output array, for writing the result to. It must have a shape that (default:None
) the inputs broadcast to.
- Return type:
Container
- Returns:
ret – Container containing the transformed inputs.
Examples
>>> a = ivy.array(np.array([ 6.+0.j, -2.+2.j, -2.+0.j, -2.-2.j])) >>> b = ivy.array(np.exp(2j * np.pi * np.arange(8) / 8)) >>> c = ivy.Container(a=a, b=b) >>> dims = ivy.Container(a=0, b=0) >>> c.fft(dims) { a: ivy.array([0.+0.j, 12.+0.j, 8.+0.j, 4.+0.j]), b: ivy.array([-3.44509285e-16+1.14423775e-17j, 8.00000000e+00-8.11483250e-16j, 2.33486982e-16+1.22464680e-16j, 0.00000000e+00+1.22464680e-16j, 9.95799250e-17+2.33486982e-16j, 0.00000000e+00+7.66951701e-17j, 1.14423775e-17+1.22464680e-16j, 0.00000000e+00+1.22464680e-16j]) }
- idct(*, type=2, n=None, axis=-1, norm=None, out=None)[source]#
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 (
Literal
[1, 2, 3, 4]) – The type of the idct. Must be 1, 2, 3 or 4. (default:2
)n (
Optional
[int
]) – The length of the transform. If n is less than the input signal length, (default:None
) then x is truncated, if n is larger then x is zero-padded.norm (
Optional
[Literal
[‘ortho’]]) – The type of normalization to be applied. Must be either None or “ortho”. (default:None
)out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – The transformed input.
Examples
>>> x = ivy.Container(a=ivy.array([8, 16, 24, 32, 40, 48, 56, 64]), ... b=ivy.array([1, 2, 3, 4, 5, 6, 7, 8])) >>> x.idct(type=2, norm='ortho') { a: ivy.array([79.49862671, -70.37691498, 30.00390816, -23.58938599, 13.92713165, -10.078475, 5.19664812, -1.95411837]), b: ivy.array([9.94, -8.79711437, 3.76, -2.94867325, 1.74089146, -1.25980937, 0.64958102, -0.2442648]) }
- ifft(dim, *, norm='backward', n=None, out=None)[source]#
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 (
int
) – The dimension along which to take the one dimensional IFFT.norm (
str
) – Optional argument, “backward”, “ortho” or “forward”. Defaults to be (default:'backward'
) “backward”. “backward” indicates no normalization. “ortho” indicates normalization by 1/sqrt(n). “forward” indicates normalization by 1/n.n (
Optional
[Union
[int
,Tuple
[int
]]]) – Optional argument indicating the sequence length, if given, the input (default:None
) would be padded with zero or truncated to length n before performing IFFT. Should be a integer greater than 1.out (
Optional
[Array
]) – Optional output array, for writing the result to. It must have a shape that (default:None
) the inputs broadcast to.
- Returns:
ret – Container containing the transformed inputs.
Examples
>>> a = ivy.array(np.array([ 6.+0.j, -2.+2.j, -2.+0.j, -2.-2.j])) >>> b = ivy.array(np.exp(2j * np.pi * np.arange(8) / 8)) >>> c = ivy.Container(a=a, b=b) >>> dims = ivy.Container(a=0, b=0) >>> c.ifft(dims) { a: ivy.array([0.+0.j, 1.+0.j, 2.+0.j, 3.+0.j]), b: ivy.array([-4.30636606e-17+1.43029718e-18j, 0.00000000e+00+1.53080850e-17j, 1.43029718e-18+1.53080850e-17j, 0.00000000e+00+9.58689626e-18j, 1.24474906e-17+2.91858728e-17j, 0.00000000e+00+1.53080850e-17j, 2.91858728e-17+1.53080850e-17j, 1.00000000e+00-1.01435406e-16j]) }
- interpolate(size, /, *, mode='linear', scale_factor=None, recompute_scale_factor=None, align_corners=None, antialias=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
Down/up samples the input to the given size. The algorithm used for interpolation is determined by mode.
- Parameters:
x – Input array, Must have the shape [batch x channels x [optional depth] x [optional height] x width].
size (
Union
[Sequence
[int
],int
]) – Output size.mode (
Literal
[‘linear’, ‘bilinear’, ‘trilinear’, ‘nearest’, ‘area’, ‘nearest_exact’, ‘tf_area’, ‘bicubic’]) – Interpolation mode. Can be one of the following: (default:'linear'
) - linear - bilinear - trilinear - nearest - area - tf_area - bicubic - mitchellcubic - lanczos3 - lanczos5 - gaussianscale_factor (
Optional
[Union
[int
,Sequence
[int
]]]) – Multiplier for spatial size that defines the output (default:None
) size (overwriting size).align_corners (
Optional
[bool
]) – If True, the corner pixels of the input and output tensors are aligned, (default:None
) 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: Falseantialias (
bool
) – If True, antialiasing is applied when downsampling an image. (default:False
) Supported modes: ‘bilinear’, ‘bicubic’.out (
Optional
[Container
]) – Optional output array, for writing the result to. It must (default:None
) have a shape that the inputs broadcast to.
- Return type:
Container
- Returns:
resized array
- max_pool1d(kernel, strides, padding, /, *, data_format='NWC', key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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
]]) – Size of the kernel i.e., the sliding window for each dimension of input. [w].strides (
Union
[int
,Tuple
[int
]]) – The stride of the sliding window for each dimension of input.padding (
str
) – SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.data_format (
str
) – NWC” or “NCW”. Defaults to “NWC”. (default:'NWC'
)out (
Optional
[Container
]) – optional output array, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – The result of the pooling operation.
Examples
>>> a = ivy.arange(12.).reshape((2,2,3)) >>> b = ivy.arange(24.).reshape((2,3,4)) >>> x = ivy.Container({'a': a, 'b': b}) >>> print(x.max_pool1d(2, 2, "VALID")) { a: ivy.array([[[3., 4., 5.]], [[9., 10., 11.]]]), b: ivy.array([[[4., 5., 6., 7.]], [[16., 17., 18., 19.]]]) }
- max_pool2d(kernel, strides, padding, /, *, data_format='NHWC', dilation=1, ceil_mode=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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
],Tuple
[int
,int
]]) – The size of the window to take a max over.strides (
Union
[int
,Tuple
[int
],Tuple
[int
,int
]]) – The stride of the sliding window for each dimension of input.padding (
str
) – “SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.data_format (
str
) – “NHWC” or “NCHW”. Defaults to “NHWC”. (default:'NHWC'
)dilations – The dilation factor for each dimension of input. (Default value = 1)
out (
Optional
[Container
]) – optional output array, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – The result of the pooling operation.
Examples
>>> a = ivy.arange(12).reshape((2, 1, 3, 2)) >>> b = ivy.arange(48).reshape((2, 4, 3, 2)) >>> x = ivy.Container({'a': a, 'b': b}) >>> print(x.max_pool2d((2, 2), (1, 1), "SAME")) { a: (<class ivy.array.array.Array> shape=[2, 1, 3, 2]), b: (<class ivy.array.array.Array> shape=[2, 4, 3, 2]) }
- max_pool3d(kernel, strides, padding, /, *, data_format='NDHWC', key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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 – Input volume [batch_size,d,h,w,d_in].
kernel (
Union
[int
,Tuple
[int
],Tuple
[int
,int
,int
]]) – Convolution filters [d,h,w].strides (
Union
[int
,Tuple
[int
],Tuple
[int
,int
,int
]]) – The stride of the sliding window for each dimension of input.padding (
str
) – SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.data_format (
str
) – NDHWC” or “NCDHW”. Defaults to “NDHWC”. (default:'NDHWC'
)out (
Optional
[Container
]) – optional output array, for writing the result to. It must (default:None
) have a shape that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – The result of the pooling operation.
Examples
>>> a = ivy.arange(12).reshape((1, 2, 1, 3, 2)) >>> b = ivy.arange(48).reshape((2, 2, 2, 3, 2)) >>> x = ivy.Container({'a': a, 'b': b}) >>> print(x.max_pool3d(2, 1, "VALID")) { a: ivy.array([], shape=(1, 1, 0, 2, 2)), b: ivy.array([[[[[20, 21], [22, 23]]]], [[[[44, 45], [46, 47]]]]]) }
- static static_adaptive_avg_pool1d(input, output_size, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
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.output_size (
int
) – Spatial output size.
- Return type:
Container
- Returns:
The result of the pooling operation. Will have shape (N, C, L_out) or
(C, L_out), where L_out = output_size
- static static_adaptive_avg_pool2d(input, output_size, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
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
]) – 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.output_size (
Union
[Sequence
[int
],int
]) – Spatial output size.
- Return type:
Container
- Returns:
The result of the pooling operation. Will have shape (N, C, S_0, S_1) or
(C, S_0, S_1), where S = output_size
- static static_avg_pool1d(x, kernel, strides, padding, /, *, data_format='NWC', count_include_pad=False, ceil_mode=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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
]]) – Size of the kernel i.e., the sliding window for each dimension of input. [w].strides (
Union
[int
,Tuple
[int
]]) – The stride of the sliding window for each dimension of input.padding (
str
) – SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.data_format (
str
) – NWC” or “NCW”. Defaults to “NWC”. (default:'NWC'
)count_include_pad (
bool
) – Whether to include padding in the averaging calculation. (default:False
)ceil_mode (
bool
) – Whether to use ceil or floor for creating the output shape. (default:False
)out (
Optional
[Container
]) – optional output array, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – The result of the pooling operation.
Examples
>>> a = ivy.arange(12.).reshape((2,2,3)) >>> b = ivy.arange(24.).reshape((2,3,4)) >>> x = ivy.Container({'a': a, 'b': b}) >>> print(ivy.Container.static_avg_pool1d(x,2, 2, "VALID")) { a: ivy.array([[[1.5, 2.5, 3.5]], [[7.5, 8.5, 9.5]]]), b: ivy.array([[[2., 3., 4., 5.]], [[14., 15., 16., 17.]]]) }
- static static_avg_pool2d(x, kernel, strides, padding, /, *, data_format='NHWC', count_include_pad=False, ceil_mode=False, divisor_override=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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
]]) – The size of the window to take a max over.strides (
Union
[int
,Tuple
[int
],Tuple
[int
,int
]]) – The stride of the sliding window for each dimension of input.padding (
str
) – “SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.data_format (
str
) – “NHWC” or “NCHW”. Defaults to “NHWC”. (default:'NHWC'
)count_include_pad (
bool
) – Whether to include padding in the averaging calculation. (default:False
)ceil_mode (
bool
) – Whether to use ceil or floor for creating the output shape. (default:False
)divisor_override (
Optional
[int
]) – If specified, it will be used as divisor, (default:None
) otherwise kernel_size will be used.out (
Optional
[Container
]) – optional output array, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – The result of the pooling operation.
Examples
>>> a = ivy.arange(12).reshape((2, 1, 3, 2)) >>> b = ivy.arange(48).reshape((2, 4, 3, 2)) >>> x = ivy.Container({'a': a, 'b': b}) >>> print(ivy.Container.static_avg_pool2d(x, (2, 2), (1, 1), "SAME")) { a: ivy.array([], shape=(2, 0, 2, 2)), b: (<class ivy.array.array.Array> shape=[2, 3, 2, 2]) }
- static static_avg_pool3d(x, kernel, strides, padding, /, *, data_format='NDHWC', count_include_pad=False, ceil_mode=False, divisor_override=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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].kernel (
Union
[int
,Tuple
[int
],Tuple
[int
,int
,int
]]) – Convolution filters [d,h,w].strides (
Union
[int
,Tuple
[int
],Tuple
[int
,int
,int
]]) – The stride of the sliding window for each dimension of input.padding (
str
) – SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.data_format (
str
) – NDHWC” or “NCDHW”. Defaults to “NDHWC”. (default:'NDHWC'
)count_include_pad (
bool
) – Whether to include padding in the averaging calculation. (default:False
)ceil_mode (
bool
) – Whether to use ceil or floor for creating the output shape. (default:False
)divisor_override (
Optional
[int
]) – If specified, it will be used as the divisor, otherwise (default:None
)out (
Optional
[Container
]) – optional output array, for writing the result to. It must (default:None
) have a shape that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – The result of the pooling operation.
Examples
>>> a = ivy.arange(12).reshape((1, 2, 1, 3, 2)) >>> b = ivy.arange(48).reshape((2, 2, 2, 3, 2)) >>> x = ivy.Container({'a': a, 'b': b}) >>> print(ivy.Container.static_avg_pool3d(x, 2, 1, "VALID")) { a: ivy.array([], shape=(1, 1, 0, 2, 2)), b: ivy.array([[[[[10., 11.], [12., 13.]]]], [[[[34., 35.], [36., 37.]]]]]) }
- static static_dct(x, /, *, type=2, n=None, axis=-1, norm=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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 (
Literal
[1, 2, 3, 4]) – The type of the dct. Must be 1, 2, 3 or 4. (default:2
)n (
Optional
[int
]) – The lenght of the transform. If n is less than the input signal lenght, (default:None
) then x is truncated, if n is larger than x is zero-padded.norm (
Optional
[Literal
[‘ortho’]]) – The type of normalization to be applied. Must be either None or “ortho”. (default:None
)out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – The transformed input.
Examples
With one
ivy.Container
input:>>> x = ivy.Container(a=ivy.array([8, 16, 24, 32, 40, 48, 56, 64]), ... b=ivy.array([1, 2, 3, 4, 5, 6, 7, 8])) >>> ivy.Container.static_dct(x, type=2, norm='ortho') { a: ivy.array([102., -51.5, 0., -5.39, 0., -1.61, 0., -0.406]), b: ivy.array([12.7, -6.44, 0., -0.673, 0., -0.201, 0., -0.0507]) }
With multiple
ivy.Container
inputs:>>> x = ivy.Container(a=ivy.array([ 8, 16, 24, 32, 40, 48, 56, 64]), ... b=ivy.array([11., 54, 23., 13., 255., 255., 132., 182.])) >>> n = ivy.Container(a=9, b=5) >>> type = ivy.Container(a=2, b=4) >>> norm = ivy.Container(a="ortho", b=None) >>> ivy.Container.static_dct(x, type=type, n=n, norm=norm) { a: ivy.array([96., -28.2, -31.9, 22.9, -26., 19.8, -17., 10.9, -5.89]), b: ivy.array([242., -253., 286., -515., 467.]) }
- static static_dft(x, /, *, axis=1, inverse=False, onesided=False, dft_length=None, norm='backward', key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) –axis (
int
) – (default:1
)inverse (
bool
) – (default:False
)onesided (
bool
) – (default:False
)dft_length (
Optional
[Union
[int
,Tuple
[int
]]]) – (default:None
)norm (
str
) – (default:'backward'
)key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – (default:None
)to_apply (
bool
) – (default:True
)prune_unapplied (
bool
) – (default:False
)map_sequences (
bool
) – (default:False
)out (
Optional
[Array
]) – (default:None
)
- Return type:
Container
- static static_embedding(weight, indices, /, *, max_norm=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
- Return type:
Container
- static static_idct(x, /, *, type=2, n=None, axis=-1, norm=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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 (
Literal
[1, 2, 3, 4]) – The type of the dct. Must be 1, 2, 3 or 4. (default:2
)n (
Optional
[int
]) – The length of the transform. If n is less than the input signal length, (default:None
) then x is truncated, if n is larger than x is zero-padded.norm (
Optional
[Literal
[‘ortho’]]) – The type of normalization to be applied. Must be either None or “ortho”. (default:None
)out (
Optional
[Container
]) – optional output container, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – The transformed input.
Examples
With one
ivy.Container
input:>>> x = ivy.Container(a=ivy.array([8, 16, 24, 32, 40, 48, 56, 64]), ... b=ivy.array([1, 2, 3, 4, 5, 6, 7, 8])) >>> ivy.Container.static_idct(x, type=2, norm='ortho') { a: ivy.array([79.49862671, -70.37691498, 30.00390816, -23.58938599, 13.92713165, -10.078475, 5.19664812, -1.95411837]), b: ivy.array([9.93732834, -8.79711437, 3.75048852, -2.94867325, 1.74089146, -1.25980937, 0.64958102, -0.2442648]) }
With multiple
ivy.Container
inputs:>>> x = ivy.Container(a=ivy.array([ 8, 16, 24, 32, 40, 48, 56, 64]), ... b=ivy.array([11., 54, 23., 13., 255., 255., 132., 182.])) >>> n = ivy.Container(a=9, b=5) >>> type = ivy.Container(a=2, b=4) >>> norm = ivy.Container(a="ortho", b=None) >>> ivy.Container.static_idct(x, type=type, n=n, norm=norm) { a: ivy.array([86.29723358, -66.6950531, 9.93914509, 2.88008738, -16.18951225, 18.06697273, -17.57439804, 11.68861485, -4.41308832]), b: ivy.array([242.0700836, -253.2449036, 285.6711426, -514.501709, 467.4924011]) }
- static static_ifft(x, dim, *, norm='backward', n=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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 (
int
) – The dimension along which to take the one dimensional IFFT.norm (
str
) – Optional argument, “backward”, “ortho” or “forward”. Defaults to be (default:'backward'
) “backward”. “backward” indicates no normalization. “ortho” indicates normalization by 1/sqrt(n). “forward” indicates normalization by 1/n.n (
Optional
[Union
[int
,Tuple
[int
]]]) – Optional argument indicating the sequence length, if given, the input would (default:None
) be padded with zero or truncated to length n before performing IFFT. Should be a integer greater than 1.out (
Optional
[Container
]) – Optional output array, for writing the result to. It must have a shape that (default:None
) the inputs broadcast to.
- Returns:
ret – The transformed input.
Examples
>>> a = ivy.array(np.array([ 6.+0.j, -2.+2.j, -2.+0.j, -2.-2.j])) >>> b = ivy.array(np.exp(2j * np.pi * np.arange(8) / 8)) >>> c = ivy.Container(a=a, b=b) >>> dims = ivy.Container(a=0, b=0) >>> ivy.Container.static_ifft(c, dims) { a: ivy.array([0.+0.j, 1.+0.j, 2.+0.j, 3.+0.j]), b: ivy.array([-4.30636606e-17+1.43029718e-18j, 0.00000000e+00+1.53080850e-17j, 1.43029718e-18+1.53080850e-17j, 0.00000000e+00+9.58689626e-18j, 1.24474906e-17+2.91858728e-17j, 0.00000000e+00+1.53080850e-17j, 2.91858728e-17+1.53080850e-17j, 1.00000000e+00-1.01435406e-16j]) }
- static static_interpolate(x, size, /, *, mode='linear', scale_factor=None, recompute_scale_factor=None, align_corners=None, antialias=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
Down/up samples the input to the given size. The algorithm used for interpolation is determined by mode.
- Parameters:
x (
Union
[Array
,NativeArray
,Container
]) – Input array, Must have the shape [batch x channels x [optional depth] x [optional height] x width].size (
Union
[Sequence
[int
],int
]) – Output size.mode (
Literal
[‘linear’, ‘bilinear’, ‘trilinear’, ‘nearest’, ‘area’, ‘nearest_exact’, ‘tf_area’, ‘bicubic’]) – Interpolation mode. Can be one of the following: (default:'linear'
) - linear - bilinear - trilinear - nearest - area - tf_area - bicubic - mitchellcubic - lanczos3 - lanczos5 - gaussianscale_factor (
Optional
[Union
[int
,Sequence
[int
]]]) – Multiplier for spatial size that defines the output (default:None
) size (overwriting size).align_corners (
Optional
[bool
]) – If True, the corner pixels of the input and output tensors are aligned, (default:None
) 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: Falseantialias (
bool
) – If True, antialiasing is applied when downsampling an image. (default:False
) Supported modes: ‘bilinear’, ‘bicubic’.out (
Optional
[Container
]) – Optional output array, for writing the result to. It must (default:None
) have a shape that the inputs broadcast to.
- Return type:
Container
- Returns:
resized array
- static static_max_pool1d(x, kernel, strides, padding, /, *, data_format='NWC', key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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
]]) – Size of the kernel i.e., the sliding window for each dimension of input. [w].strides (
Union
[int
,Tuple
[int
]]) – The stride of the sliding window for each dimension of input.padding (
str
) – SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.data_format (
str
) – NWC” or “NCW”. Defaults to “NWC”. (default:'NWC'
)out (
Optional
[Container
]) – optional output array, for writing the result to. (default:None
)
- Return type:
Container
- Returns:
ret – The result of the pooling operation.
Examples
>>> a = ivy.arange(12.).reshape((2,2,3)) >>> b = ivy.arange(24.).reshape((2,3,4)) >>> x = ivy.Container({'a': a, 'b': b}) >>> print(ivy.Container.static_max_pool1d(x,2, 2, "VALID")) { a: ivy.array([[[3., 4., 5.]], [[9., 10., 11.]]]), b: ivy.array([[[4., 5., 6., 7.]], [[16., 17., 18., 19.]]]) }
- static static_max_pool2d(x, kernel, strides, padding, /, *, data_format='NHWC', dilation=1, ceil_mode=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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
],Tuple
[int
,int
]]) – The size of the window to take a max over.strides (
Union
[int
,Tuple
[int
],Tuple
[int
,int
]]) – The stride of the sliding window for each dimension of input.padding (
str
) – “SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.data_format (
str
) – “NHWC” or “NCHW”. Defaults to “NHWC”. (default:'NHWC'
)out (
Optional
[Container
]) – optional output array, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – The result of the pooling operation.
Examples
>>> a = ivy.arange(12).reshape((2, 1, 3, 2)) >>> b = ivy.arange(48).reshape((2, 4, 3, 2)) >>> x = ivy.Container({'a': a, 'b': b}) >>> print(ivy.Container.static_max_pool2d(x, (2, 2), (1, 1), "SAME")) { a: (<class ivy.array.array.Array> shape=[2, 1, 3, 2]), b: (<class ivy.array.array.Array> shape=[2, 4, 3, 2]) }
- static static_max_pool3d(x, kernel, strides, padding, /, *, data_format='NDHWC', key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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].kernel (
Union
[int
,Tuple
[int
],Tuple
[int
,int
,int
]]) – Convolution filters [d,h,w].strides (
Union
[int
,Tuple
[int
],Tuple
[int
,int
,int
]]) – The stride of the sliding window for each dimension of input.padding (
str
) – SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.data_format (
str
) – NDHWC” or “NCDHW”. Defaults to “NDHWC”. (default:'NDHWC'
)out (
Optional
[Container
]) – optional output array, for writing the result to. It must (default:None
) have a shape that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – The result of the pooling operation.
Examples
>>> a = ivy.arange(12).reshape((1, 2, 1, 3, 2)) >>> b = ivy.arange(48).reshape((2, 2, 2, 3, 2)) >>> x = ivy.Container({'a': a, 'b': b}) >>> print(ivy.Container.static_max_pool3d(x, 2, 1, "VALID")) { a: ivy.array([], shape=(1, 1, 0, 2, 2)), b: ivy.array([[[[[20, 21], [22, 23]]]], [[[[44, 45], [46, 47]]]]]) }
- class ivy.data_classes.container.experimental.linear_algebra._ContainerWithLinearAlgebraExperimental(dict_in=None, queues=None, queue_load_sizes=None, container_combine_method='list_join', queue_timeout=None, print_limit=10, key_length_limit=None, print_indent=4, print_line_spacing=0, ivyh=None, default_key_color='green', keyword_color_dict=None, rebuild_child_containers=False, types_to_iteratively_nest=None, alphabetical_keys=True, dynamic_backend=None, **kwargs)[source]#
- _abc_impl = <_abc_data object>#
- adjoint(*, key_chains=None, to_apply=True, out=None)[source]#
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.
Examples
>>> x = np.array([[1.-1.j, 2.+2.j], [3.+3.j, 4.-4.j]]) >>> c = ivy.Container(a=ivy.array(x)) >>> c.adjoint() { a: ivy.array([[1.+1.j, 3.-3.j], [2.-2.j, 4.+4.j]]) }
- cond(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, p=None)[source]#
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
]]) – order of the norm of the matrix (see ivy.norm). (default:None
)
- Returns:
ret – container including array corresponding to condition number of input array
Examples
>>> x = ivy.array([[1,2], [3,4]]) >>> c = ivy.Container(a=x) >>> c.cond() ivy.array(14.933034)
>>> x = ivy.array([[1,2], [3,4]]) >>> c = ivy.Container(a=x) >>> c.cond(p=1) ivy.array(21.0)
With
ivy.Container
input:>>> a = ivy.Container(x=ivy.arange(2 * 3).reshape((2, 3)), ... y=ivy.arange(2 * 3).reshape((2, 3))) >>> a.cond() { x: ivy.array(14.933034), y: ivy.array(14.933034) }
- cov(x2=None, /, *, rowVar=True, bias=False, ddof=None, fweights=None, aweights=None, dtype=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
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
]) – optional second 1D or 2D input array, nativearray, or container, with a (default:None
) numeric data type. Must have the same shape asself
.rowVar (
bool
) – optional variable where each row of input is interpreted as a variable (default:True
) (default = True). If set to False, each column is instead interpreted as a variable.bias (
bool
) – optional variable for normalizing input (default = False) by (N - 1) where (default:False
) N is the number of given observations. If set to True, then normalization is instead by N. Can be overridden by keywordddof
.ddof (
Optional
[int
]) – optional variable to overridebias
(default = None). ddof=1 will return (default:None
) the unbiased estimate, even with fweights and aweights given. ddof=0 will return the simple average.fweights (
Optional
[Array
]) – optional 1D array of integer frequency weights; the number of times each (default:None
) observation vector should be repeated.aweights (
Optional
[Array
]) – optional 1D array of observation vector weights. These relative weights are (default:None
) 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
]]) – optional variable to set data-type of the result. By default, data-type (default:None
) will have at leastnumpy.float64
precision.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out – optional 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).
Examples
>>> 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 = x.cov(y) >>> print(z) { a: ivy.container([ 1., -1., -1., -1.] [ 1., 1., -1., -1.]), b: ivy.container([-1., -1., 1., 1.] [-1., 1., 1., 1.]) }
- diagflat(*, offset=0, padding_value=0, align='RIGHT_LEFT', num_rows=-1, num_cols=-1, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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.
Examples
>>> x = ivy.Container(a=[1,2]) >>> ivy.diagflat(x, k=1) { a: ivy.array([[0, 1, 0], [0, 0, 2], [0, 0, 0]]) }
- Return type:
Container
- eig(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
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
Examples
>>> x = ivy.array([[1,2], [3,4]]) >>> c = ivy.Container({'x':{'xx':x}}) >>> c.eig() { x: { xx: (tuple(2), <class ivy.array.array.Array>, shape=[2, 2]) } } >>>c.eig()['x']['xx'] ( ivy.array([-0.37228107+0.j, 5.3722816 +0.j]), ivy.array([ [-0.8245648 +0.j, -0.41597357+0.j], [0.56576747+0.j, -0.9093767 +0.j] ]) )
- eigh_tridiagonal(beta, /, *, eigvals_only=True, select='a', select_range=None, tol=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
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 (
bool
) – If False, both eigenvalues and corresponding eigenvectors are computed. (default:True
) If True, only eigenvalues are computed. Default is True.select (
str
) – Optional string with values in {‘a’, ‘v’, ‘i’} (default is ‘a’) that (default:'a'
) 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
]]) – Size 2 tuple or list or array specifying the range of eigenvalues to (default:None
) compute together with select. If select is ‘a’, select_range is ignored.tol (
Optional
[float
]) – Optional scalar. Ignored when backend is not Tensorflow. The absolute (default:None
) 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.
Examples
>>> alpha = ivy.Container(a=ivy.array([0., 1., 2.]), b=ivy.array([2., 2., 2.])) >>> beta = ivy.array([0.,2.]) >>> y = alpha.eigh_tridiagonal(beta) >>> print(y) { a: ivy.array([-0.56155, 0., 3.56155]), b: ivy.array([0., 2., 4.]) }
>>> alpha = ivy.Container(a=ivy.array([0., 1., 2.]), b=ivy.array([2., 2., 2.])) >>> beta = ivy.Container(a=ivy.array([0.,2.]), b=ivy.array([2.,2.])) >>> y = alpha.eigh_tridiagonal(beta) >>> print(y) { a: ivy.array([-0.56155, 0., 3.56155]), b: ivy.array([-0.82842, 2., 4.82842]) }
- eigvals(*, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
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
Examples
>>> x = ivy.array([[1,2], [3,4]]) >>> c = ivy.Container({'x':{'xx':x}}) >>> c.eigvals() { x: { xx: ivy.array([-0.37228132+0.j, 5.37228132+0.j]) } } >>> c.eigvals()['x']['xx'] ivy.array([-0.37228132+0.j, 5.37228132+0.j])
- kron(b, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
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.
Examples
>>> a = ivy.Container(x=ivy.array([1,2]), y=ivy.array([50])) >>> b = ivy.Container(x=ivy.array([3,4]), y=ivy.array(9)) >>> a.kron(b) { a: ivy.array([3, 4, 6, 8]) b: ivy.array([450]) }
- Return type:
Container
- matrix_exp(*, key_chains=None, to_apply=True, out=None)[source]#
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.
Examples
>>> x = ivy.array([[[1., 0.], [0., 1.]], [[2., 0.], [0., 2.]]]) >>> ivy.matrix_exp(x) ivy.array([[[2.7183, 1.0000], [1.0000, 2.7183]], [[7.3891, 1.0000], [1.0000, 7.3891]]])
- Return type:
Container
- multi_dot(arrays, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=True, out=None)[source]#
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.
Examples
>>> a = ivy.Container(x=ivy.arange(2 * 3).reshape((2, 3)), ... y=ivy.arange(2 * 3).reshape((2, 3))) >>> b = ivy.Container(x=ivy.arange(3 * 2).reshape((3, 2)), ... y=ivy.arange(3 * 2).reshape((3, 2))) >>> c = ivy.Container(x=ivy.arange(2 * 2).reshape((2, 2)), ... y=ivy.arange(2 * 2).reshape((2, 2))) >>> a.multi_dot((b, c)) { x: ivy.array([[26, 49], [80, 148]]), y: ivy.array([[26, 49], [80, 148]]) }
- Return type:
Container
- static static_adjoint(x, /, *, key_chains=None, to_apply=True, out=None)[source]#
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
]) – optional output container, for writing the result to. (default:None
)
- Returns:
ret – container including arrays corresponding to the conjugate transpose of the arrays in the input container
Examples
>>> x = np.array([[1.-1.j, 2.+2.j], [3.+3.j, 4.-4.j]]) >>> y = np.array([[1.-2.j, 3.+4.j], [1.-0.j, 2.+6.j]]) >>> c = ivy.Container(a=ivy.array(x), b=ivy.array(y)) >>> ivy.Container.static_adjoint(c) { a: ivy.array([[1.+1.j, 3.-3.j], [2.-2.j, 4.+4.j]]), b: ivy.array([[1.+2.j, 1.-0.j], [3.-4.j, 2.-6.j]]) }
- static static_cond(self, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, p=None, out=None)[source]#
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:
self (
Container
) – container with input arrays.p (
Optional
[Union
[int
,float
]]) – order of the norm of the matrix (see ivy.norm). (default:None
)
- Returns:
ret – container including array corresponding to condition number of input array
Examples
>>> x = ivy.array([[1,2], [3,4]]) >>> ivy.Container.static_cond(x) ivy.array(14.933034)
- static static_cov(x1, x2=None, /, *, rowVar=True, bias=False, ddof=None, fweights=None, aweights=None, dtype=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
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
]]) – optional second 1D or 2D input array, nativearray, or container, with a (default:None
) numeric data type. Must have the same shape as x1.rowVar (
bool
) – optional variable where each row of input is interpreted as a variable (default:True
) (default = True). If set to False, each column is instead interpreted as a variable.bias (
bool
) – optional variable for normalizing input (default = False) by (N - 1) where (default:False
) N is the number of given observations. If set to True, then normalization is instead by N. Can be overridden by keywordddof
.ddof (
Optional
[int
]) – optional variable to overridebias
(default = None). ddof=1 will return (default:None
) the unbiased estimate, even with fweights and aweights given. ddof=0 will return the simple average.fweights (
Optional
[Array
]) – optional 1D array of integer frequency weights; the number of times each (default:None
) observation vector should be repeated.aweights (
Optional
[Array
]) – optional 1D array of observation vector weights. These relative weights are (default:None
) 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
]]) – optional variable to set data-type of the result. By default, data-type (default:None
) will have at leastnumpy.float64
precision.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out – optional 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) {- a: ivy.container([ 1., -1., -1., -1.]
[ 1., 1., -1., -1.]),
- b: ivy.container([-1., -1., 1., 1.]
[-1., 1., 1., 1.])
}
- static static_diagflat(x, /, *, offset=0, padding_value=0, align='RIGHT_LEFT', num_rows=-1, num_cols=-1, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
- Return type:
Container
- static static_eig(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
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
Examples
>>> x = ivy.array([[1,2], [3,4]]) >>> c = ivy.Container({'x':{'xx':x}}) >>> ivy.Container.eig(c) { x: { xx: (tuple(2), <class ivy.array.array.Array>, shape=[2, 2]) } } >>> ivy.Container.eig(c)['x']['xx'] ( ivy.array([-0.37228107+0.j, 5.3722816 +0.j]), ivy.array([ [-0.8245648 +0.j, -0.41597357+0.j], [0.56576747+0.j, -0.9093767 +0.j] ]) )
- static static_eigh_tridiagonal(alpha, beta, /, *, eigvals_only=True, select='a', select_range=None, tol=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
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 (
bool
) – If False, both eigenvalues and corresponding eigenvectors are computed. (default:True
) If True, only eigenvalues are computed. Default is True.select (
str
) – Optional string with values in {‘a’, ‘v’, ‘i’} (default:'a'
) (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
]]) – Size 2 tuple or list or array specifying the range of (default:None
) eigenvalues to compute together with select. If select is ‘a’, select_range is ignored.tol (
Optional
[float
]) – Optional scalar. Ignored when backend is not Tensorflow. The (default:None
) 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.
Examples
With
ivy.Container
input:>>> alpha = ivy.Container(a=ivy.array([0., 1., 2.]), b=ivy.array([2., 2., 2.])) >>> beta = ivy.array([0.,2.]) >>> y = ivy.Container.static_eigh_tridiagonal(alpha, beta) >>> print(y) { a: ivy.array([-0.56155, 0., 3.56155]), b: ivy.array([0., 2., 4.]) }
>>> alpha = ivy.Container(a=ivy.array([0., 1., 2.]), b=ivy.array([2., 2., 2.])) >>> beta = ivy.Container(a=ivy.array([0.,2.]), b=ivy.array([2.,2.])) >>> y = ivy.Container.static_eigh_tridiagonal(alpha, beta) >>> print(y) { a: ivy.array([-0.56155, 0., 3.56155]), b: ivy.array([-0.82842, 2., 4.82842]) }
- static static_eigvals(x, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
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
Examples
>>> x = ivy.array([[1,2], [3,4]]) >>> c = ivy.Container({'x':{'xx':x}}) >>> ivy.Container.eigvals(c) { x: { xx: ivy.array([-0.37228132+0.j, 5.37228132+0.j]) } } >>> ivy.Container.eigvals(c)['x']['xx'] ivy.array([-0.37228132+0.j, 5.37228132+0.j])
- static static_kron(a, b, /, *, key_chains=None, to_apply=True, prune_unapplied=False, <