id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
148,289
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
r"""Calculate an implementation-dependent approximation to the base ``10`` logarithm, having domain ``[0, +infinity]`` and codomain ``[-infinity, +infinity]``, for each element ``x_i`` of the input array ``x``. **Special cases** For floating-point operands, - If ``x_i`` is ``NaN``, the result is ``NaN``. - If ``x_i`` i...
148,290
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Calculate an implementation-dependent approximation to log(1+x), where log refers to the natural (base e) logarithm. .. note:: The purpose of this function is to calculate ``log(1+x)`` more accurately when `x` is close to zero. Accordingly, conforming implementations should avoid implementing this function as simply ``...
148,291
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
r"""Calculate an implementation-dependent approximation to the base ``2`` logarithm, having domain ``[0, +infinity]`` and codomain ``[-infinity, +infinity]``, for each element ``x_i`` of the input array ``x``. **Special cases** For floating-point operands, - If ``x_i`` is ``NaN``, the result is ``NaN``. - If ``x_i`` is...
148,292
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Calculate the logarithm of the sum of exponentiations ``log(exp(x1) + exp(x2))`` for each element ``x1_i`` of the input array ``x1`` with the respective element ``x2_i`` of the input array ``x2``. **Special cases** For floating-point operands, - If either ``x1_i`` or ``x2_i`` is ``NaN``, the result is ``NaN``. - If ``x...
148,293
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Calculate log2(2**x1 + 2**x2). Parameters ---------- x1 First array-like input. x2 Second array-input. out optional output array, for writing the result to. Returns ------- ret Element-wise logaddexp2 of x1 and x2. Examples -------- >>> x1 = ivy.array([1, 2, 3]) >>> x2 = ivy.array([4, 5, 6]) >>> ivy.logaddexp2(x1, x2) ...
148,294
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Compute the logical AND for each element x1_i of the input array x1 with the respective element x2_i of the input array x2. Parameters ---------- x1 first input array. Should have a boolean data type. x2 second input array. Must be compatible with x1. Should have a boolean data type. out optional output array, for writ...
148,295
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Compute the logical NOT for each element ``x_i`` of the input array ``x``. .. note:: While this specification recommends that this function only accept input arrays having a boolean data type, specification-compliant array libraries may choose to accept input arrays having numeric data types. If non-boolean data types ...
148,296
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Compute the logical OR for each element ``x1_i`` of the input array ``x1`` with the respective element ``x2_i`` of the input array ``x2``. .. note:: While this specification recommends that this function only accept input arrays having a boolean data type, specification-compliant array libraries may choose to accept in...
148,297
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Compute the bitwise XOR of the underlying binary representation of each element ``x1_i`` of the input array ``x1`` with the respective element ``x2_i`` of the input array ``x2``. Parameters ---------- x1 first input array. Should have an integer or boolean data type. x2 second input array. Must be compatible with ``x1`...
148,298
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Replace NaN with zero and infinity with large finite numbers (default behaviour) or with the numbers defined by the user using the nan, posinf and/or neginf keywords. Parameters ---------- x Array input. copy Whether to create a copy of x (True) or to replace values in-place (False). The in-place operation only occurs ...
148,299
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Return a new array with the negative value of each element in ``x``. .. note:: For signed integer data types, the numerical negative of the minimum representable integer is implementation-dependent. .. note:: If ``x`` has a complex floating-point data type, both the real and imaginary components for each ``x_i`` must b...
148,300
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Compute the truth value of ``x1_i != x2_i`` for each element ``x1_i`` of the input array ``x1`` with the respective element ``x2_i`` of the input array ``x2``. **Special Cases** For real-valued floating-point operands, - If ``x1_i`` is ``NaN`` or ``x2_i`` is ``NaN``, the result is ``True``. - If ``x1_i`` is ``+infinity...
148,301
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Return a new array with the positive value of each element in ``x``. Parameters ---------- x Input array. out optional output array, for writing the result to. It must have a shape that the inputs broadcast to. Returns ------- ret A new array with the positive value of each element in ``x``. This function conforms to t...
148,302
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Calculate an implementation-dependent approximation of exponentiation by raising each element ``x1_i`` (the base) of the input array ``x1`` to the power of ``x2_i`` (the exponent), where ``x2_i`` is the corresponding element of the input array ``x2``. **Special cases** For floating-point operands, - If ``x1_i`` is not ...
148,303
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
null
148,304
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Test each element ``x_i`` of the input array ``x`` to take only real part from it. Returns a float array, where it only contains . If element has complex type with zero complex part, the return value will be that element, else it only returns real part. Parameters ---------- x input array. out optional output array, fo...
148,305
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Return the remainder of division for each element ``x1_i`` of the input array ``x1`` and the respective element ``x2_i`` of the input array ``x2``. .. note:: This function is equivalent to the Python modulus operator ``x1_i % x2_i``. For input arrays which promote to an integer data type, the result of division by zero...
148,306
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Round each element ``x_i`` of the input array ``x`` to the nearest integer-valued number. .. note:: For complex floating-point operands, real and imaginary components must be independently rounded to the nearest integer-valued number. Rounded real and imaginary components must be equal to their equivalent rounded real-...
148,307
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
r"""Return an indication of the sign of a number for each element ``x_i`` of the input array ``x``. The sign function (also known as the **signum function**) of a number :math:`x_{i}` is defined as .. math:: \operatorname{sign}(x_i) = \begin{cases} 0 & \textrm{if } x_i = 0 \\ \frac{x}{|x|} & \textrm{otherwise} \end{cas...
148,308
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
r"""Calculate an implementation-dependent approximation to the sine, having domain ``(-infinity, +infinity)`` and codomain ``[-1, +1]``, for each element ``x_i`` of the input array ``x``. Each element ``x_i`` is assumed to be expressed in radians. .. note:: The sine is an entire function on the complex plane and has no...
148,309
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
r"""Calculate an implementation-dependent approximation to the hyperbolic sine, having domain ``[-infinity, +infinity]`` and codomain ``[-infinity, +infinity]``, for each element ``x_i`` of the input array ``x``. .. math:: \operatorname{sinh}(x) = \frac{e^x - e^{-x}}{2} .. note:: The hyperbolic sine is an entire functi...
148,310
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
r"""Calculate the square root, having domain ``[0, +infinity]`` and codomain ``[0, +infinity]``, for each element ``x_i`` of the input array ``x``. After rounding, each result must be indistinguishable from the infinitely precise result (as required by IEEE 754). .. note:: After rounding, each result must be indistingu...
148,311
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Each element ``x_i`` of the input array ``x``. Parameters ---------- x Input array. Should have a numeric data type. out optional output array, for writing the result to. It must have a shape that the inputs broadcast to. Returns ------- ret an array containing the evaluated result for each element in ``x``. This metho...
148,312
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Calculate the difference for each element ``x1_i`` of the input array ``x1`` with the respective element ``x2_i`` of the input array ``x2``. Parameters ---------- x1 first input array. Should have a numeric data type. x2 second input array. Must be compatible with ``x1`` (see ref:`broadcasting`). Should have a numeric ...
148,313
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
r"""Calculate an implementation-dependent approximation to the tangent, having domain ``(-infinity, +infinity)`` and codomain ``(-infinity, +infinity)``, for each element ``x_i`` of the input array ``x``. Each element ``x_i`` is assumed to be expressed in radians. .. note:: Tangent is an analytical function on the comp...
148,314
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Calculate an implementation-dependent approximation to the hyperbolic tangent, having domain ``[-infinity, +infinity]`` and codomain ``[-1, +1]``, for each element ``x_i`` of the input array ``x``. **Special cases** For floating-point operands, - If ``x_i`` is ``NaN``, the result is ``NaN``. - If ``x_i`` is ``+0``, the...
148,315
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Integrate along the given axis using the composite trapezoidal rule. If x is provided, the integration happens in sequence along its elements - they are not sorted.. Parameters ---------- y The array that should be integrated. x The sample points corresponding to the input array values. If x is None, the sample points ...
148,316
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Compute the Gauss error function of ``x`` element-wise. Parameters ---------- x input array. out optional output array, for writing the result to. It must have a shape that the inputs broadcast to. Returns ------- ret The Gauss error function of x. Examples -------- With :class:`ivy.Array` inputs: >>> x = ivy.array([0,...
148,317
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Return the max of x1 and x2 (i.e. x1 > x2 ? x1 : x2) element-wise. Parameters ---------- x1 Input array containing elements to maximum threshold. x2 Tensor containing maximum values, must be broadcastable to x1. use_where Whether to use :func:`where` to calculate the maximum. If ``False``, the maximum is calculated usi...
148,318
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Return the min of x1 and x2 (i.e. x1 < x2 ? x1 : x2) element-wise. Parameters ---------- x1 Input array containing elements to minimum threshold. x2 Tensor containing minimum values, must be broadcastable to x1. use_where Whether to use :func:`where` to calculate the minimum. If ``False``, the minimum is calculated usi...
148,319
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Return a new array with the reciprocal of each element in ``x``. Parameters ---------- x Input array. out optional output array, for writing the result to. It must have a shape that the inputs broadcast to. Returns ------- ret A new array with the positive value of each element in ``x``. Examples -------- >>> x = ivy.a...
148,320
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Convert the input from degrees to radians. Parameters ---------- x input array whose elements are each expressed in degrees. out optional output array, for writing the result to. It must have a shape that the inputs broadcast to. Returns ------- ret an array with each element in ``x`` converted from degrees to radians....
148,321
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Convert the input from radians to degrees. Parameters ---------- x input array whose elements are each expressed in radians. out optional output array, for writing the result to. It must have a shape that the inputs broadcast to. Returns ------- ret an array with each element in ``x`` converted from radians to degrees....
148,322
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Perform element-wise integer division of the inputs rounding the results towards zero. Parameters ---------- x1 dividend input array. Should have a numeric data type. x2 divisor input array. Must be compatible with x1 (see Broadcasting). Should have a numeric data type. out optional output array, for writing the result...
148,323
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Test each element ``x_i`` of the input array ``x`` to determine whether the element is real number. Returns a bool array, where True if input element is real. If element has complex type with zero complex part, the return value for that element is True. Parameters ---------- x input array. out optional output array, fo...
148,324
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Compute the element-wise remainder of divisions of two arrays. Parameters ---------- x1 First input array. x2 Second input array out optional output array, for writing the result to. Returns ------- ret Array with element-wise remainder of divisions. Examples -------- >>> x1 = ivy.array([2, 3, 4]) >>> x2 = ivy.array([1...
148,325
from numbers import Number from typing import Optional, Union, Literal import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_comple...
Compute the element-wise least common multiple (LCM) of x1 and x2. Parameters ---------- x1 first input array, must be integers x2 second input array, must be integers out optional output array, for writing the result to. Returns ------- ret an array that includes the element-wise least common multiples of x1 and x2 Ex...
148,326
from builtins import map as _map from typing import Callable, Any, Union, List, Tuple, Optional, Dict, Iterable, Sequence from collections import UserDict, OrderedDict import ivy from ivy.utils.exceptions import handle_exceptions def index_nest( nest: Union[List, Tuple, Dict, ivy.Array, ivy.NativeArray, ivy.Contain...
Repeatedly index a nested object, using a tuple of tuples of indices or keys in the case of dicts. Parameters ---------- nest The nested object to slice. indices A tuple of tuples of indices to apply. Returns ------- ret The result elements through indexing the nested object. Examples -------- With :code:`Tuple` inputs...
148,327
from builtins import map as _map from typing import Callable, Any, Union, List, Tuple, Optional, Dict, Iterable, Sequence from collections import UserDict, OrderedDict import ivy from ivy.utils.exceptions import handle_exceptions def prune_nest_at_index(nest: Iterable, index: Tuple, /) -> None: """Prune a nested ob...
Prune a nested object at specified indices. Parameters ---------- nest The nested object to prune. indices A tuple of tuples of indices for the indices at which to prune.
148,328
from builtins import map as _map from typing import Callable, Any, Union, List, Tuple, Optional, Dict, Iterable, Sequence from collections import UserDict, OrderedDict import ivy from ivy.utils.exceptions import handle_exceptions def set_nest_at_index( nest: Union[ivy.Array, ivy.NativeArray, ivy.Container, Dict, Li...
Set the value of a nested item at specified indices with specified values. Parameters ---------- nest The nested object to update. indices A tuple of tuples of indices for the indices at which to update. values The new values for updating. shallow Whether to inplace update the input nest or not Only works if nest is a ...
148,329
from builtins import map as _map from typing import Callable, Any, Union, List, Tuple, Optional, Dict, Iterable, Sequence from collections import UserDict, OrderedDict import ivy from ivy.utils.exceptions import handle_exceptions def insert_into_nest_at_index(nest: Iterable, index: Tuple, value) -> None: """Recursi...
Insert a value into the nested item at specified indices with specified values. Parameters ---------- nest The nested object to insert into. indices A tuple of tuples of indices for the indices at which to insert values. values The new values for inserting.
148,330
from builtins import map as _map from typing import Callable, Any, Union, List, Tuple, Optional, Dict, Iterable, Sequence from collections import UserDict, OrderedDict import ivy from ivy.utils.exceptions import handle_exceptions def map_nest_at_index( nest: Union[ivy.Array, ivy.NativeArray, ivy.Container, Dict, Li...
Map a function to the values of a nested item at the specified indices. Parameters ---------- nest The nested object to update. indices A tuple of tuples of indices for the indices at which to update. fn The function to perform on the nest at the given index. shallow Whether to inplace update the input nest or not Only...
148,331
from builtins import map as _map from typing import Callable, Any, Union, List, Tuple, Optional, Dict, Iterable, Sequence from collections import UserDict, OrderedDict import ivy from ivy.utils.exceptions import handle_exceptions import ivy.utils.backend.handler from ivy.utils import check_for_binaries from ivy._versi...
Return indices of all the elements in nest. Parameters ---------- nest The nest to check the leaves of. include_nests Whether to also include indices of the nests themselves, not only leaves. Default is ``False``. _index The indices detected so far. None at the beginning. Used internally, do not set manually. _base Whe...
148,332
from builtins import map as _map from typing import Callable, Any, Union, List, Tuple, Optional, Dict, Iterable, Sequence from collections import UserDict, OrderedDict import ivy from ivy.utils.exceptions import handle_exceptions import ivy.utils.backend.handler from ivy.utils import check_for_binaries from ivy._versi...
Apply a function on each item of an iterable x. Parameters ---------- fn The function to map onto x. constant keyword arguments which remain constant between each function call. Default is ``None``. unique keyword arguments which are unique for each function call. Default is ``None``. mean Whether to compute the mean a...
148,333
from builtins import map as _map from typing import Callable, Any, Union, List, Tuple, Optional, Dict, Iterable, Sequence from collections import UserDict, OrderedDict import ivy from ivy.utils.exceptions import handle_exceptions import ivy.utils.backend.handler from ivy.utils import check_for_binaries from ivy._versi...
Apply a function on x in a nested manner, whereby all dicts, lists and tuples are traversed to their lowest leaves before applying the method and returning x. If x is not nested, the method is applied to x directly. Parameters ---------- fn The function to map onto x. x The item to apply the mapped function to. include...
148,334
from builtins import map as _map from typing import Callable, Any, Union, List, Tuple, Optional, Dict, Iterable, Sequence from collections import UserDict, OrderedDict import ivy from ivy.utils.exceptions import handle_exceptions The provided code snippet includes necessary dependencies for implementing the `nested_an...
Check the leaf nodes of nest x via function fn, and returns True if any evaluate to True, else False. Parameters ---------- nest The nest to check the leaves of. fn The condition function, returning True or False. check_nests Whether to also check the nests for the condition, not only nest leaves. Default is ``False``....
148,335
from builtins import map as _map from typing import Callable, Any, Union, List, Tuple, Optional, Dict, Iterable, Sequence from collections import UserDict, OrderedDict import ivy from ivy.utils.exceptions import handle_exceptions import ivy.utils.backend.handler from ivy.utils import check_for_binaries from ivy._versi...
Apply function to all array values from a collection of identically structured ivy arrays. Parameters ---------- func Function to apply to each nest entry. nest nests to map. index_chains The key-chains to apply or not apply the method to. Default is ``None``. to_apply If True, the method will be applied to index_chain...
148,336
from builtins import map as _map from typing import Callable, Any, Union, List, Tuple, Optional, Dict, Iterable, Sequence from collections import UserDict, OrderedDict import ivy from ivy.utils.exceptions import handle_exceptions def index_nest( nest: Union[List, Tuple, Dict, ivy.Array, ivy.NativeArray, ivy.Contain...
Group all unique index chains in a nest. This function is useful for finding all unique index chains in a nest, and then duplicating the values at those index chains for functional frameworks. Parameters ---------- nest nest to get duplicate index chains for. Returns ------- list of index chains to duplicate.
148,337
from builtins import map as _map from typing import Callable, Any, Union, List, Tuple, Optional, Dict, Iterable, Sequence from collections import UserDict, OrderedDict import ivy from ivy.utils.exceptions import handle_exceptions import ivy.utils.backend.handler from ivy.utils import check_for_binaries from ivy._versi...
Prune empty nests from a nest. Parameters ---------- nest nest to prune. Returns ------- pruned nest with all empty nests removed
148,338
import os import gc import abc import math import psutil import warnings import types from typing import Type, Optional, Tuple from typing import Union, Callable, Iterable, Any import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, inputs_to_native_arrays, handle_nesta...
null
148,339
import os import gc import abc import math import psutil import warnings import types from typing import Type, Optional, Tuple from typing import Union, Callable, Iterable, Any import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, inputs_to_native_arrays, handle_nesta...
Return the number of arrays which are currently alive on the specified device. Parameters ---------- device The device handle from which to count the arrays Returns ------- ret Number of arrays on the specified device Examples -------- >>> x1 = ivy.array([-1, 0, 5.2]) >>> x2 = ivy.array([-1, 0, 5.2, 4, 5]) >>> y = ivy....
148,340
import os import gc import abc import math import psutil import warnings import types from typing import Type, Optional, Tuple from typing import Union, Callable, Iterable, Any import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, inputs_to_native_arrays, handle_nesta...
Print the shape and dtype for all ivy arrays which are currently alive on the specified device. Parameters ---------- device The device on which to print the arrays attr_only Whether or not to only print the `shape` and `dtype` attributes of the array Examples -------- >>> x = ivy.array([[1,0,2], [3,2,1]]) >>> y = ivy....
148,341
import os import gc import abc import math import psutil import warnings import types from typing import Type, Optional, Tuple from typing import Union, Callable, Iterable, Any import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, inputs_to_native_arrays, handle_nesta...
Set the mode of whether to move input arrays to `ivy.default_device()` before performing an operation. Parameter --------- mode boolean whether to move input arrays Examples -------- >>> ivy.set_soft_device_mode(False) >>> ivy.soft_device_mode False >>> ivy.set_soft_device_mode(True) >>> ivy.soft_device_mode True
148,342
import os import gc import abc import math import psutil import warnings import types from typing import Type, Optional, Tuple from typing import Union, Callable, Iterable, Any import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, inputs_to_native_arrays, handle_nesta...
Reset the mode of moving input arrays to `ivy.default_device()` before performing an operation. Examples -------- >>> ivy.set_soft_device_mode(False) >>> ivy.soft_device_mode False >>> ivy.unset_soft_device_mode() >>> ivy.soft_device_mode True
148,343
import os import gc import abc import math import psutil import warnings import types from typing import Type, Optional, Tuple try: import pynvml try: pynvml.nvmlInit() except pynvml.NVMLError: pass except ImportError: warnings.warn( "pynvml installation was not found in the envi...
Get the total amount of memory (in GB) for a given device string. In case of CPU, the total RAM is returned. Parameters ---------- device The device string to convert to native device handle. Returns ------- ret The total memory on the device in GB. Examples -------- >>> x = ivy.total_mem_on_dev("cpu") >>> print(x) 53....
148,344
import os import gc import abc import math import psutil import warnings import types from typing import Type, Optional, Tuple try: import pynvml try: pynvml.nvmlInit() except pynvml.NVMLError: pass except ImportError: warnings.warn( "pynvml installation was not found in the envi...
Get the used memory (in GB) for a given device string. In case of CPU, the used RAM is returned. Parameters ---------- device The device string to convert to native device handle. process_specific Whether to check the memory used by this python process alone. Default is False. Returns ------- ret The used memory on the...
148,345
import os import gc import abc import math import psutil import warnings import types from typing import Type, Optional, Tuple try: import pynvml try: pynvml.nvmlInit() except pynvml.NVMLError: pass except ImportError: warnings.warn( "pynvml installation was not found in the envi...
Get the percentage used memory for a given device string. In case of CPU, the used RAM is returned. Parameters ---------- device The device string to convert to native device handle. process_specific Whether the check the memory used by this python process alone. Default is False. Returns ------- ret The percentage use...
148,346
import os import gc import abc import math import psutil import warnings import types from typing import Type, Optional, Tuple try: import pynvml try: pynvml.nvmlInit() except pynvml.NVMLError: pass except ImportError: warnings.warn( "pynvml installation was not found in the envi...
Get the current utilization (%) for a given device. Parameters ---------- device The device string of the device to query utilization for. Returns ------- ret The device utilization (%) Example ------- >>> ivy.dev_util('cpu') 13.4 >>> ivy.dev_util('gpu:0') 7.8 >>> ivy.dev_util('cpu') 93.4 >>> ivy.dev_util('gpu:2') 57.4...
148,347
import os import gc import abc import math import psutil import warnings import types from typing import Type, Optional, Tuple from typing import Union, Callable, Iterable, Any import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, inputs_to_native_arrays, handle_nesta...
Determine whether a GPU is available to use, with the backend framework. Returns ------- ret Boolean, as to whether a gpu is available. Examples -------- >>> print(ivy.gpu_is_available()) False
148,348
import os import gc import abc import math import psutil import warnings import types from typing import Type, Optional, Tuple from typing import Union, Callable, Iterable, Any import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, inputs_to_native_arrays, handle_nesta...
Determine the number of cores available in the cpu. Parameters ---------- logical Whether request is for number of physical or logical cores available in CPU Returns ------- ret Number of cores available in CPU Examples -------- >>> print(ivy.num_cpu_cores(logical=False)) 2
148,349
import os import gc import abc import math import psutil import warnings import types from typing import Type, Optional, Tuple from typing import Union, Callable, Iterable, Any import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, inputs_to_native_arrays, handle_nesta...
Determine whether a TPU is available to use, with the backend framework. Returns ------- ret Boolean, as to whether a tpu is available. Examples -------- >>> ivy.set_backend("torch") >>> print(ivy.tpu_is_available()) False
148,350
import os import gc import abc import math import psutil import warnings import types from typing import Type, Optional, Tuple from typing import Union, Callable, Iterable, Any import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, inputs_to_native_arrays, handle_nesta...
Sets the default device to the argument provided in the function. Parameters ---------- device The device to be set as the default device. Returns ------- ret The new default device. Examples -------- >>> ivy.default_device() 'cpu' >>> ivy.set_backend('jax') >>> ivy.set_default_device('gpu:0') >>> ivy.default_device() ...
148,351
import os import gc import abc import math import psutil import warnings import types from typing import Type, Optional, Tuple from typing import Union, Callable, Iterable, Any import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, inputs_to_native_arrays, handle_nesta...
Reset the default device to "cpu". Examples -------- >>> ivy.set_default_device("gpu:0") >>> ivy.default_device() "gpu:0" >>> ivy.unset_default_device() >>> ivy.default_device() "cpu"
148,352
import os import gc import abc import math import psutil import warnings import types from typing import Type, Optional, Tuple from typing import Union, Callable, Iterable, Any import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, inputs_to_native_arrays, handle_nesta...
Set the global split factor for a given device, which can be used to scale batch splitting chunk sizes for the device across the codebase. Parameters ---------- factor The factor to set the device-specific split factor to. device The device to set the split factor for. Sets the default device by default. Examples -----...
148,353
import os import gc import abc import math import psutil import warnings import types from typing import Type, Optional, Tuple from typing import Union, Callable, Iterable, Any import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, inputs_to_native_arrays, handle_nesta...
Call a function by splitting its inputs along a given axis, and calling the function in chunks, rather than feeding the entire input array at once. This can be useful to reduce memory usage of the device the arrays are on. Parameters ---------- func The function to be called. inputs A list of inputs to pass into the fu...
148,354
import os import gc import abc import math import psutil import warnings import types from typing import Type, Optional, Tuple from typing import Union, Callable, Iterable, Any import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, inputs_to_native_arrays, handle_nesta...
Return the unsupported devices of the current backend's function. The function returns a dict containing the unsupported devices for the compositional and primary implementations in case of partial mixed functions. Parameters ---------- fn The function to check for the unsupported device attribute recurse Whether to re...
148,355
from typing import Optional, Union import ivy from ivy.func_wrapper import ( handle_array_function, infer_dtype, handle_out_argument, to_native_arrays_and_back, inputs_to_native_shapes, handle_nestable, handle_device, handle_backend_invalid, ) from ivy.utils.backend import backend_stack ...
Draws samples from a uniform distribution. Samples are uniformly distributed over the half-open interval ``[low, high)`` (includes ``low``, but excludes ``high``). In other words, any value within the given interval is equally likely to be drawn by uniform. Parameters ---------- low Lower boundary of the output interva...
148,356
from typing import Optional, Union import ivy from ivy.func_wrapper import ( handle_array_function, infer_dtype, handle_out_argument, to_native_arrays_and_back, inputs_to_native_shapes, handle_nestable, handle_device, handle_backend_invalid, ) from ivy.utils.backend import backend_stack ...
Draws samples from a normal distribution. Parameters ---------- mean The mean of the normal distribution to sample from. Default is ``0.0``. std The standard deviation of the normal distribution to sample from. Must be non-negative. Default is ``1.0``. shape If the given shape is, e.g ``(m, n, k)``, then ``m * n * k`` ...
148,357
from typing import Optional, Union import ivy from ivy.func_wrapper import ( handle_array_function, infer_dtype, handle_out_argument, to_native_arrays_and_back, inputs_to_native_shapes, handle_nestable, handle_device, handle_backend_invalid, ) from ivy.utils.backend import backend_stack ...
Draws samples from a multinomial distribution. Specifically, returns a tensor where each row contains num_samples indices sampled from the multinomial probability distribution located in the corresponding row of tensor input. Parameters ---------- population_size The size of the population from which to draw samples. n...
148,358
from typing import Optional, Union import ivy from ivy.func_wrapper import ( handle_array_function, infer_dtype, handle_out_argument, to_native_arrays_and_back, inputs_to_native_shapes, handle_nestable, handle_device, handle_backend_invalid, ) from ivy.utils.backend import backend_stack ...
Return an array filled with random integers generated uniformly between low (inclusive) and high (exclusive). Parameters ---------- low Lowest integer that can be drawn from the distribution. high One above the highest integer that can be drawn from the distribution. shape If the given shape is, e.g ``(m, n, k)``, then...
148,359
from typing import Optional, Union import ivy from ivy.func_wrapper import ( handle_array_function, infer_dtype, handle_out_argument, to_native_arrays_and_back, inputs_to_native_shapes, handle_nestable, handle_device, handle_backend_invalid, ) from ivy.utils.backend import backend_stack ...
Set the seed for random number generation. Parameters ---------- seed_value Seed for random number generation, must be a positive integer. (Default value = 0) Examples -------- >>> ivy.seed(seed_value=42)
148,360
from typing import Optional, Union import ivy from ivy.func_wrapper import ( handle_array_function, infer_dtype, handle_out_argument, to_native_arrays_and_back, inputs_to_native_shapes, handle_nestable, handle_device, handle_backend_invalid, ) from ivy.utils.backend import backend_stack ...
Shuffles the given array along a given axis. Parameters ---------- x Input array. Should have a numeric data type. axis The axis which x is shuffled along. Default is 0. seed A python integer. Used to create a random seed distribution out optional output array, for writing the result to. It must have a shape that the i...
148,361
from typing import Optional, Tuple, Union, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, handle_partial_mixed_function, inputs_to_ivy_arrays, to_native_arrays_and_back, inputs_to_native_shapes, handle_out_argument, han...
Apply multi-head attention to inputs x. This is an implementation of multi-headed attention as described in the paper "Attention is all you Need" (Vaswani et al., 2017). If `query`, `key`, `value` are the same, then this is self-attention. Each timestep in `query` attends to the corresponding sequence in `key`, and ret...
148,362
from typing import Optional, Tuple, Union, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, handle_partial_mixed_function, inputs_to_ivy_arrays, to_native_arrays_and_back, inputs_to_native_shapes, handle_out_argument, han...
Compute a 1-D, 2-D, and 3-D transpose or dilated convolution given 3-D, 4-D and 5-D input x respectively and filters arrays. Parameters ---------- x Input image *[batch_size,d,h,w,d_in]* or *[batch_size,d_in,d,h,w]*. filters Convolution filters *[fd,fh,fw,d_in/feature_group_count,d_out]*. strides The stride of the slid...
148,363
from typing import Optional, Tuple, Union, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, handle_partial_mixed_function, inputs_to_ivy_arrays, to_native_arrays_and_back, inputs_to_native_shapes, handle_out_argument, han...
Applies a multi-layer long-short term memory to an input sequence. Parameters ---------- input input array of shape (seq_len, batch, input_size) when `batch_first` is False or (batch, seq_len, input_size) when `batch_first` is True initial_states tuple of two arrays (h_0, c_0) where h_0 is the initial hidden state of s...
148,364
from typing import Optional, Tuple, Union, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, handle_partial_mixed_function, inputs_to_ivy_arrays, to_native_arrays_and_back, inputs_to_native_shapes, handle_out_argument, han...
Iy, ix = dims(2)
148,365
from typing import Optional, Tuple, Union, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, handle_partial_mixed_function, inputs_to_ivy_arrays, to_native_arrays_and_back, inputs_to_native_shapes, handle_out_argument, han...
null
148,366
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
null
148,367
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Broadcasts one or more arrays against one another. Parameters ---------- arrays an arbitrary number of arrays to-be broadcasted. Returns ------- ret A list containing broadcasted arrays of type `ivy.Array` Each array must have the same shape, and each array must have the same dtype as its corresponding input array. Exa...
148,368
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Determine if one data type can be cast to another data type according to :ref:`type- promotion` rules. Parameters ---------- from_ input data type or array from which to cast. to desired data type. Returns ------- ret ``True`` if the cast can occur according to :ref:`type-promotion` rules; otherwise, ``False``. This fu...
148,369
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Machine limits for floating-point data types. Parameters ---------- type the kind of floating-point data-type about which to get information. Returns ------- ret an object having the following attributes: - **bits**: *int* number of bits occupied by the floating-point data type. - **eps**: *float* difference between 1....
148,370
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Machine limits for integer data types. Parameters ---------- type the kind of integer data-type about which to get information. Returns ------- ret a class with that encapsules the following attributes: - **bits**: *int* number of bits occupied by the type. - **max**: *int* largest representable number. - **min**: *int...
148,371
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Return the dtype that results from applying the type promotion rules (see :ref:`type-promotion`) to the arguments. .. note:: If provided mixed dtypes (e.g., integer and floating-point), the returned dtype will be implementation-specific. Parameters ---------- arrays_and_dtypes an arbitrary number of input arrays and/or...
148,372
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Get the number of bits used for representing the input data type. Parameters ---------- dtype_in The data type to determine the number of bits for. Returns ------- ret The number of bits used to represent the data type. Examples -------- With :class:`ivy.Dtype` inputs: >>> x = ivy.dtype_bits(ivy.float32) >>> print(x) 3...
148,373
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Determine the closest valid datatype to the datatype passed as input. Parameters ---------- type The data type for which to check the closest valid type for. Returns ------- ret The closest valid data type as a native ivy.Dtype Examples -------- With :class:`ivy.Dtype` input: >>> xType = ivy.float16 >>> yType = ivy.clo...
148,374
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Summary. Parameters ---------- dtype as_native (Default value = False) Returns ------- Return the default data type for the “kind” (integer or floating-point) of dtype Examples -------- >>> ivy.set_default_int_dtype("int32") >>> ivy.infer_default_dtype("int8") 'int8' >>> ivy.set_default_float_dtype("float64") >>> ivy.i...
148,375
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Return the supported data types of the current backend's function. The function returns a dict containing the supported dtypes for the compositional and primary implementations in case of partial mixed functions. Parameters ---------- fn The function to check for the supported dtype attribute recurse Whether to recurse...
148,376
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Return the unsupported data types of the current backend's function. The function returns a dict containing the unsupported dtypes for the compositional and primary implementations in case of partial mixed functions. Parameters ---------- fn The function to check for the unsupported dtype attribute recurse Whether to r...
148,377
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Determine whether the provided data type is not support by the current framework. Parameters ---------- dtype_in The data type for which to check for backend non-support Returns ------- ret Boolean, whether the data-type string is un-supported. Examples -------- >>> print(ivy.invalid_dtype(None)) False >>> print(ivy.in...
148,378
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Determine whether the input data type is a bool data type. Parameters ---------- dtype_in input data type to test. Returns ------- ret "True" if the input data type is a bool, otherwise "False". Both the description and the type hints above assumes an array input for simplicity but this function is *nestable*, and ther...
148,379
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Check if the input is a float or a float-like object. Parameters ---------- x Input to check. Returns ------- ret "True" if the input is a float or a float-like object, otherwise "False".
148,380
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Set the datatype `dtype` as default data type. Parameters ---------- dtype the data_type to set as default data type Examples -------- With :class:`ivy.Dtype` input: >>> ivy.set_default_dtype(ivy.bool) >>> ivy.default_dtype_stack ['bool'] >>> ivy.unset_default_dtype() >>> ivy.set_default_dtype("float64") >>> ivy.defaul...
148,381
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Set the 'float_dtype' as the default data type. Parameters ---------- float_dtype The float data type to be set as the default. Examples -------- With :class: `ivy.Dtype` input: >>> ivy.set_default_float_dtype(ivy.floatDtype("float64")) >>> ivy.default_float_dtype() 'float64' >>> ivy.set_default_float_dtype(ivy.floatDt...
148,382
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Set the 'int_dtype' as the default data type. Parameters ---------- int_dtype The integer data type to be set as the default. Examples -------- With :class: `ivy.Dtype` input: >>> ivy.set_default_int_dtype(ivy.intDtype("int64")) >>> ivy.default_int_dtype() 'int64' >>> ivy.set_default_int_dtype(ivy.intDtype("int32")) >>...
148,383
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Set the uint dtype to be default. Parameters ---------- uint_dtype The uint dtype to be set as default. Examples -------- >>> ivy.set_default_uint_dtype(ivy.UintDtype("uint8")) >>> ivy.default_uint_dtype() 'uint8' >>> ivy.set_default_uint_dtype(ivy.UintDtype("uint64")) >>> ivy.default_uint_dtype() 'uint64'
148,384
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Set the 'complex_dtype' as the default data type. Parameters ---------- complex_dtype The complex data type to be set as the default. Examples -------- With :class: `ivy.Dtype` input: >>> ivy.set_default_complex_dtype(ivy.ComplexDtype("complex64")) >>> ivy.default_complex_dtype() 'complex64' >>> ivy.set_default_float_d...
148,385
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Type promote the input arrays, returning new arrays with the shared correct data type. Parameters ---------- x1 the first of the two arrays to type promote x2 the second of the two arrays to type promote Returns ------- ret1, ret2 The input arrays after type promotion
148,386
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Reset the current default dtype to the previous state. Examples -------- >>> ivy.set_default_dtype(ivy.int32) >>> ivy.set_default_dtype(ivy.bool) >>> ivy.default_dtype_stack ['int32', 'bool'] >>> ivy.unset_default_dtype() >>> ivy.default_dtype_stack ['int32'] >>> ivy.unset_default_dtype() >>> ivy.default_dtype_stack []
148,387
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Reset the current default float dtype to the previous state. Examples -------- >>> ivy.set_default_float_dtype(ivy.float32) >>> ivy.set_default_float_dtype(ivy.float64) >>> ivy.default_float_dtype_stack ['float32','float64'] >>> ivy.unset_default_float_dtype() >>> ivy.default_float_dtype_stack ['float32']
148,388
import ast import logging import inspect import math import functools from numbers import Number from typing import Union, Tuple, List, Optional, Callable, Iterable, Any import numpy as np import importlib import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function,...
Reset the current default int dtype to the previous state. Examples -------- >>> ivy.set_default_int_dtype(ivy.intDtype("int16")) >>> ivy.default_int_dtype() 'int16' >>> ivy.unset_default_int_dtype() >>> ivy.default_int_dtype() 'int32'