id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
148,089
import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.torch import promote_types_of_torch_inputs import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.util...
null
148,090
import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.torch import promote_types_of_torch_inputs import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.util...
null
148,091
import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.torch import promote_types_of_torch_inputs import ivy.functional.frontends.torch as torch_frontend def cumsum(input, dim, *,...
null
148,092
import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.torch import promote_types_of_torch_inputs import ivy.functional.frontends.torch as torch_frontend def lu_solve(b, LU_data,...
null
148,093
import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.torch import promote_types_of_torch_inputs import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.util...
null
148,094
import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.torch import promote_types_of_torch_inputs import ivy.functional.frontends.torch as torch_frontend def flatten(input, start_...
null
148,095
import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.torch import promote_types_of_torch_inputs import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.util...
null
148,096
import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.torch import promote_types_of_torch_inputs import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.util...
null
148,097
import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.torch import promote_types_of_torch_inputs import ivy.functional.frontends.torch as torch_frontend def flip(input, dims): ...
null
148,098
import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.torch import promote_types_of_torch_inputs import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.util...
null
148,099
import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.torch import promote_types_of_torch_inputs import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.util...
null
148,100
import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.torch import promote_types_of_torch_inputs import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.util...
null
148,101
import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.torch import promote_types_of_torch_inputs import ivy.functional.frontends.torch as torch_frontend def tril(input, diagonal=...
null
148,102
import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.torch import promote_types_of_torch_inputs import ivy.functional.frontends.torch as torch_frontend def triu(input, diagonal=...
null
148,103
import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.torch import promote_types_of_torch_inputs import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.util...
null
148,104
import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.torch import promote_types_of_torch_inputs import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.util...
null
148,105
import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.torch import promote_types_of_torch_inputs import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.util...
null
148,106
import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.torch import promote_types_of_torch_inputs import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.util...
null
148,107
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.utils.exceptions import handle_exceptions ...
null
148,108
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend def concat(tensors, dim=0, *, out=None): return ivy.concat(...
null
148,109
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend def split(tensor, split_size_or_sections, dim=0): if isinst...
null
148,110
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend def hstack(tensors, *, out=None): return ivy.hstack(tensors...
null
148,111
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.utils.exceptions import handle_exceptions ...
null
148,112
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend def reshape(input, shape): return ivy.reshape(input, shape)...
null
148,113
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.utils.exceptions import handle_exceptions ...
null
148,114
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.utils.exceptions import handle_exceptions ...
null
148,115
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.utils.exceptions import handle_exceptions ...
null
148,116
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend def stack(tensors, dim=0, *, out=None): return ivy.stack(te...
null
148,117
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend def stack(tensors, dim=0, *, out=None): return ivy.stack(te...
null
148,118
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend def gather(input, dim, index, *, sparse_grad=False, out=None): ...
null
148,119
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend def gather(input, dim, index, *, sparse_grad=False, out=None): ...
null
148,120
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.utils.exceptions import handle_exceptions ...
null
148,121
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend def moveaxis(input, source, destination): return ivy.moveax...
null
148,122
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.utils.exceptions import handle_exceptions ...
null
148,123
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.utils.exceptions import handle_exceptions ...
null
148,124
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend def vstack(tensors, *, out=None): return ivy.vstack(tensors...
null
148,125
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.utils.exceptions import handle_exceptions ...
null
148,126
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.utils.exceptions import handle_exceptions ...
null
148,127
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend def swapaxes(input, axis0, axis1): import ivy from ivy.utils.e...
null
148,128
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend def gather(input, dim, index, *, sparse_grad=False, out=None): ...
null
148,129
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.utils.exceptions import handle_exceptions ...
null
148,130
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend def split(tensor, split_size_or_sections, dim=0): if isinst...
null
148,131
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.utils.exceptions import handle_exceptions ...
null
148,132
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend def swapaxes(input, axis0, axis1): return ivy.swapaxes(inpu...
null
148,133
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend def reshape(input, shape): return ivy.reshape(input, shape)...
null
148,134
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.utils.exceptions import handle_exceptions ...
null
148,135
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.utils.exceptions import handle_exceptions ...
null
148,136
import ivy from ivy.func_wrapper import with_unsupported_dtypes from ivy.functional.frontends.torch.func_wrapper import ( to_ivy_arrays_and_back, numpy_to_torch_style_args, to_ivy_shape, ) import ivy.functional.frontends.torch as torch_frontend def nonzero(input, *, out=None, as_tuple=False): import ivy fr...
null
148,137
import ivy import ivy.functional.frontends.torch as torch_frontend import ivy from ivy.utils.exceptions import handle_exceptions from ivy.functional.frontends import set_frontend_to_specific_version if ivy.is_local(): module = ivy.utils._importlib.import_cache[__name__] else: module = sys.modul...
null
148,138
import ivy import ivy.functional.frontends.torch as torch_frontend _default_dtype = torch_frontend.float32 def get_default_dtype(): return _default_dtype
null
148,139
import ivy import ivy.functional.frontends.torch as torch_frontend def promote_types(type1, type2, /): return torch_frontend.promote_types_torch(type1, type2)
null
148,140
import ivy import ivy.functional.frontends.torch as torch_frontend _default_dtype = torch_frontend.float32 import ivy from ivy.utils.exceptions import handle_exceptions from ivy.functional.frontends import set_frontend_to_specific_version if ivy.is_local(): module = ivy.utils._importlib.import_cach...
null
148,141
import ivy from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back from sklearn.utils.multiclass import type_of_target from ivy.utils.exceptions import IvyValueError def type_of_target(y, input_name="y"): # purely utility function unique_vals = len(ivy.unique_values(y)) if y.ndim == ...
null
148,142
import ivy from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back from sklearn.utils.multiclass import type_of_target from ivy.utils.exceptions import IvyValueError class IvyValueError(IvyException, ValueError): def __init__(self, *messages, include_backend=False): super().__init__(...
null
148,143
import ivy from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back from sklearn.utils.multiclass import type_of_target from ivy.utils.exceptions import IvyValueError class IvyValueError(IvyException, ValueError): def __init__(self, *messages, include_backend=False): def precision_score(y_t...
null
148,144
import ivy from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back from sklearn.utils.multiclass import type_of_target from ivy.utils.exceptions import IvyValueError class IvyValueError(IvyException, ValueError): def __init__(self, *messages, include_backend=False): super().__init__(...
null
148,145
import ivy FEATURE_THRESHOLD = 1e-7 class SplitRecord: def __init__( self, feature=0, pos=0, threshold=0.0, improvement=-ivy.inf, impurity_left=0.0, impurity_right=0.0, missing_go_to_left=False, n_missing=0,...
null
148,146
import ivy def sort(feature_values, samples, n): if n == 0: return idx = ivy.argsort(feature_values) return feature_values[idx], samples[idx]
null
148,147
from abc import ABC, abstractmethod import ivy def _move_sums_classification( criterion, sum_1, sum_2, weighted_n_1, weighted_n_2, put_missing_in_1 ): for k in range(criterion.n_outputs): n = int(criterion.n_classes[k]) sum_1[k, :n] = 0 sum_2[k, :n] = criterion.sum_total[k, :n] wei...
null
148,148
from abc import ABCMeta, abstractmethod import ivy from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.sklearn.utils.validation import column_or_1d def train_test_split( *arrays, test_size=None, train_size=None, random_state=None, shuffle=Tru...
null
148,149
import ivy import numbers from ivy.functional.frontends.numpy.func_wrapper import outputs_to_frontend_arrays def make_circles( n_samples=100, *, shuffle=True, noise=None, random_state=None, factor=0.8 ): # numbers.Integral also includes bool if isinstance(n_samples, numbers.Integral): n_samples_out...
null
148,150
import ivy import numbers from ivy.functional.frontends.numpy.func_wrapper import outputs_to_frontend_arrays def make_moons(n_samples=100, *, shuffle=True, noise=None, random_state=None): if isinstance(n_samples, numbers.Integral): n_samples_out = n_samples // 2 n_samples_in = n_samples - n_samples...
null
148,151
import ivy from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back from ivy.func_wrapper import with_unsupported_dtypes def as_float_array(X, *, copy=True, force_all_finite=True): if X.dtype in [ivy.float32, ivy.float64]: return X.copy_array() if copy else X if ("bool" in X.dtype...
null
148,152
import ivy from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back from ivy.func_wrapper import with_unsupported_dtypes def column_or_1d(y, *, warn=False): shape = y.shape if len(shape) == 2 and shape[1] == 1: y = ivy.reshape(y, (-1,)) elif len(shape) > 2: raise Value...
null
148,153
from typing import Sequence, Union, Optional, Tuple, Callable import numpy as np import itertools import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, inputs_to_ivy_arrays, to_native_arrays_and_back, handle_out_argument, handle_nestable, ...
Create a function that evaluates both func and the gradient of func. Parameters ---------- func Function for which we compute the gradients of the output with respect to xs input. Returns ------- ret A function that returns both func and the gradient of func. Examples -------- With :class:`ivy.Array` input: >>> x = ivy...
148,154
from typing import Sequence, Union, Optional, Tuple, Callable import numpy as np import itertools import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, inputs_to_ivy_arrays, to_native_arrays_and_back, handle_out_argument, handle_nestable, ...
Call function func, and return func's Jacobian partial derivatives. Parameters ---------- func Function for which we compute the gradients of the output with respect to xs input. Returns ------- ret the Jacobian function Examples -------- With :class:`ivy.Array` input: >>> x = ivy.array([[4.6, 2.1, 5], [2.8, 1.3, 6.2]]...
148,155
from typing import Sequence, Union, Optional, Tuple, Callable import numpy as np import itertools import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, inputs_to_ivy_arrays, to_native_arrays_and_back, handle_out_argument, handle_nestable, ...
Update weights ws of some function, given the derivatives of some cost c with respect to ws, [dc/dw for w in ws], by applying Layerwise Adaptive Rate Scaling (LARS) method. Parameters ---------- w Weights of the function to be updated. dcdw Derivates of the cost c with respect to the weights ws, [dc/dw for w in ws]. lr...
148,156
from typing import Sequence, Union, Optional, Tuple, Callable import numpy as np import itertools import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, inputs_to_ivy_arrays, to_native_arrays_and_back, handle_out_argument, handle_nestable, ...
Update weights ws of some function, given the derivatives of some cost c with respect to ws, using ADAM update. `[reference] <https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Adam>`_ Parameters ---------- w Weights of the function to be updated. dcdw Derivates of the cost c with respect to the weights ws, [dc/...
148,157
from typing import Sequence, Union, Optional, Tuple, Callable import numpy as np import itertools import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, inputs_to_ivy_arrays, to_native_arrays_and_back, handle_out_argument, handle_nestable, ...
Update weights ws of some function, given the derivatives of some cost c with respect to ws, [dc/dw for w in ws], by applying LAMB method. Parameters ---------- w Weights of the function to be updated. dcdw Derivates of the cost c with respect to the weights ws, [dc/dw for w in ws]. lr Learning rate(s), the rate(s) at ...
148,158
from typing import Union, Optional, Literal, List import ivy from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, handle_backend_invalid, ) from ivy.utils.exceptions import h...
Return the indices that sort an array ``x`` along a specified axis. Parameters ---------- x input array. axis axis along which to sort. If set to ``-1``, the function must sort along the last axis. Default: ``-1``. descending sort order. If ``True``, the returned indices sort ``x`` in descending order (by value). If ``...
148,159
from typing import Union, Optional, Literal, List import ivy from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, handle_backend_invalid, ) from ivy.utils.exceptions import h...
Return a sorted copy of an array. Parameters ---------- x input array axis axis along which to sort. If set to ``-1``, the function must sort along the last axis. Default: ``-1``. descending direction The direction in which to sort the values stable sort stability. If ``True``, the returned indices must maintain the re...
148,160
from typing import Union, Optional, Literal, List import ivy from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, handle_backend_invalid, ) from ivy.utils.exceptions import h...
Return a copy of an array sorted along the first axis. Parameters ---------- a array-like input. out optional output array, for writing the result to. Returns ------- ret sorted array of the same type and shape as a Examples -------- >>> a = ivy.asarray([[8, 9, 6],[6, 2, 6]]) >>> ivy.msort(a) ivy.array( [[6, 2, 6], [8,...
148,161
from typing import Union, Optional, Literal, List import ivy from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, handle_backend_invalid, ) from ivy.utils.exceptions import h...
Return the indices of the inserted elements in a sorted array. Parameters ---------- x Input array. If `sorter` is None, then it must be sorted in ascending order, otherwise `sorter` must be an array of indices that sort it. v specific elements to insert in array x1 side The specific elements' index is at the 'left' si...
148,162
from typing import List, Union, Optional import ivy from ivy.func_wrapper import ( handle_array_like_without_promotion, handle_nestable, handle_array_function, inputs_to_ivy_arrays, ) from ivy.utils.exceptions import handle_exceptions import ivy.utils.backend.handler from ivy.utils import check_for_bin...
Apply Layer Normalization over a mini-batch of inputs. Parameters ---------- x Input array normalized_idxs Indices to apply the normalization to. scale Learnable gamma variables for elementwise post-multiplication, default is ``None``. offset Learnable beta variables for elementwise post-addition, default is ``None``. ...
148,163
from numbers import Number from typing import Union, Optional, Tuple import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, hand...
Return the indices of the maximum values along a specified axis. When the maximum value occurs multiple times, only the indices corresponding to the first occurrence are returned. Parameters ---------- x input array. Should have a numeric data type. axis axis along which to search. If None, the function must return the...
148,164
from numbers import Number from typing import Union, Optional, Tuple import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, hand...
Return the indices of the minimum values along a specified axis. When the minimum value occurs multiple times, only the indices corresponding to the first occurrence are returned. Parameters ---------- x input array. Should have a numeric data type. axis axis along which to search. If None, the function must return the...
148,165
from numbers import Number from typing import Union, Optional, Tuple import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, hand...
Return the indices of the array elements which are non-zero. .. note:: If ``x`` has a complex floating-point data type, non-zero elements are those elements having at least one component (real or imaginary) which is non-zero. .. note:: If ``x`` has a boolean data type, non-zeroelements are those elements which are equa...
148,166
from numbers import Number from typing import Union, Optional, Tuple import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, hand...
Return elements chosen from x or y depending on condition. Parameters ---------- condition Where True, yield x1, otherwise yield x2. x1 values from which to choose when condition is True. x2 values from which to choose when condition is False. out optional output array, for writing the result to. It must have a shape t...
148,167
from numbers import Number from typing import Union, Optional, Tuple import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, hand...
Return the indices of all non-zero elements of the input array. Parameters ---------- x input array, for which indices are desired. out optional output array, for writing the result to. It must have a shape that the inputs broadcast to. Returns ------- ret Indices of non-zero elements. Examples -------- With :class:`iv...
148,168
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Compute the cholesky decomposition of the x matrix. Parameters ---------- x input array having shape (..., M, M) and whose innermost two dimensions form square symmetric positive-definite matrices. Should have a floating-point data type. upper If True, the result must be the upper-triangular Cholesky factor U. If False...
148,169
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Return cross product of 3-element vectors. If x1 and x2 are multi- dimensional arrays (i.e., both have a rank greater than 1), then the cross- product of each pair of corresponding 3-element vectors is independently computed. Parameters ---------- x1 first input array. Should have a numeric data type. x2 second input a...
148,170
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Return the determinant of a square matrix (or a stack of square matrices)``x``. Parameters ---------- x input array having shape ``(..., M, M)`` and whose innermost two dimensions form square matrices. Should have a floating-point data type. out optional output array, for writing the result to. It must have a shape tha...
148,171
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Return the specified diagonals of a matrix (or a stack of matrices) ``x``. Parameters ---------- x input array having shape ``(..., M, N)`` and whose innermost two dimensions form ``MxN`` matrices. offset offset specifying the off-diagonal relative to the main diagonal. - ``offset = 0``: the main diagonal. - ``offset >...
148,172
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Return an eigendecomposition x = QLQᵀ of a symmetric matrix (or a stack of symmetric matrices) ``x``, where ``Q`` is an orthogonal matrix (or a stack of matrices) and ``L`` is a vector (or a stack of vectors). .. note:: The function ``eig`` currently behaves like ``eigh``, as it requires complex number support, once co...
148,173
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
r"""Return an eigendecomposition x = QLQᵀ of a symmetric matrix (or a stack of symmetric matrices) ``x``, where ``Q`` is an orthogonal matrix (or a stack of matrices) and ``L`` is a vector (or a stack of vectors). .. note:: The function ``eig`` will be added in a future version of the specification, as it requires comp...
148,174
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Return the eigenvalues of a symmetric matrix (or a stack of symmetric matrices) x. .. note:: The function ``eig`` will be added in a future version of the specification, as it requires complex number support, once complex numbers are supported, each square matrix must be Hermitian. .. note:: Whether an array library ex...
148,175
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Return the inner product of two vectors ``x1`` and ``x2``. Parameters ---------- x1 first one-dimensional input array of size N. Should have a numeric data type. a(N,) array_like First input vector. Input is flattened if not already 1-dimensional. x2 second one-dimensional input array of size M. Should have a numeric d...
148,176
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Return the multiplicative inverse of a square matrix (or a stack of square matrices) ``x``. Parameters ---------- x input array having shape ``(..., M, M)`` and whose innermost two dimensions form square matrices. Should have a floating-point data type. out optional output array, for writing the result to. It must have...
148,177
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Compute the matrix product. Parameters ---------- x1 first input array. Should have a numeric data type. Must have at least one dimension. x2 second input array. Should have a numeric data type. Must have at least one dimension. transpose_a if True, ``x1`` is transposed before multiplication. transpose_b if True, ``x2`...
148,178
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Compute the matrix p-norm. Parameters ---------- x Input array having shape (..., M, N) and whose innermost two dimensions form MxN matrices. Should have a floating-point data type. ord order of the norm. The following mathematical norms must be supported: +------------------+---------------------------------+ | ord | ...
148,179
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Raise a square matrix (or a stack of square matrices) x to an integer power n. Parameters ---------- x input array having shape (..., M, M) and whose innermost two dimensions form square matrices. Should have a floating-point data type. n integer exponent. Returns ------- ret if n is equal to zero, an array containing ...
148,180
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Return the rank (i.e., number of non-zero singular values) of a matrix (or a stack of matrices). Parameters ---------- x input array having shape ``(..., M, N)`` and whose innermost two dimensions form ``MxN`` matrices. Should have a floating-point data type. atol absolute tolerance. When None it's considered to be zer...
148,181
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Return the outer product of two vectors ``x1`` and ``x2``. Parameters ---------- x1 first one-dimensional input array of size N. Should have a numeric data type. a(N,) array_like First input vector. Input is flattened if not already 1-dimensional. x2 second one-dimensional input array of size M. Should have a numeric d...
148,182
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Return the (Moore-Penrose) pseudo-inverse of a matrix (or a stack of matrices) ``x``. Parameters ---------- x input array having shape ``(..., M, N)`` and whose innermost two dimensions form ``MxN`` matrices. Should have a floating-point data type. rtol relative tolerance for small singular values. Singular values appr...
148,183
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Return the qr decomposition x = QR of a full column rank matrix (or a stack of matrices), where Q is an orthonormal matrix (or a stack of matrices) and R is an upper-triangular matrix (or a stack of matrices). Parameters ---------- x input array having shape (..., M, N) and whose innermost two dimensions form MxN matri...
148,184
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Return the sign and the natural logarithm of the absolute value of the determinant of a square matrix (or a stack of square matrices) ``x``. .. note:: The purpose of this function is to calculate the determinant more accurately when the determinant is either very small or very large, as calling ``det`` may overflow or ...
148,185
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Return a singular value decomposition A = USVh of a matrix (or a stack of matrices) ``x``, where ``U`` is a matrix (or a stack of matrices) with orthonormal columns, ``S`` is a vector of non-negative numbers (or stack of vectors), and ``Vh`` is a matrix (or a stack of matrices) with orthonormal rows. Parameters -------...
148,186
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Return the singular values of a matrix (or a stack of matrices) ``x``. Parameters ---------- x input array having shape ``(..., M, N)`` and whose innermost two dimensions form ``MxN`` matrices. driver optional output array,name of the cuSOLVER method to be used. This keyword argument only works on CUDA inputs. Availabl...
148,187
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Return a tensor contraction of x1 and x2 over specific axes. .. note:: If either ``x1`` or ``x2`` has a complex floating-point data type, neither argument must be complex-conjugated or transposed. If conjugation and/or transposition is desired, these operations should explicitly performed prior to computing the general...
148,188
from typing import Union, Optional, Tuple, Literal, List, Sequence import ivy from ivy.utils.backend import current_backend from ivy.func_wrapper import ( handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, ...
Return the sum along the specified diagonals of a matrix (or a stack of matrices) ``x``. **Special cases** Let ``N`` equal the number of elements over which to compute the sum. - If ``N`` is ``0``, the sum is ``0`` (i.e., the empty sum). For both real-valued and complex floating-point operands, special cases must be ha...