id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
148,489
from typing import Union, Tuple, Optional, Sequence, Iterable, Generator import warnings import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( outputs_to_ivy_arrays, handle_nestable, to_native_arrays_and_back, handle_ou...
Multidimensional index iterator. Parameters ---------- shape The shape of the array to iterate over. Returns ------- ret An iterator yielding array coordinates. Examples -------- >>> a = ivy.array([[1, 2], [3, 4]]) >>> for index in ivy.ndindex(a): >>> print(index) (0, 0) (0, 1) (1, 0) (1, 1)
148,490
from typing import Union, Tuple, Optional, Sequence, Iterable, Generator import warnings import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( outputs_to_ivy_arrays, handle_nestable, to_native_arrays_and_back, handle_ou...
Return an array representing the indices of a grid. Parameters ---------- dimensions The shape of the grid. dtype The data type of the result. sparse Return a sparse representation of the grid instead of a dense representation. Returns ------- ret If sparse is False, returns one grid indices array of shape (len(dimensi...
148,491
from typing import Union, Tuple, Optional, Sequence, Iterable, Generator import warnings import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( outputs_to_ivy_arrays, handle_nestable, to_native_arrays_and_back, handle_ou...
Compute the minimum along segments of an array. Segments are defined by an integer array of segment IDs. Note ---- If the given segment ID `i` is negative, then the corresponding value is dropped, and will not be included in the result. Parameters ---------- data The array from which to gather values. segment_ids Must ...
148,492
from typing import Union, Tuple, Optional, Sequence, Iterable, Generator import warnings import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( outputs_to_ivy_arrays, handle_nestable, to_native_arrays_and_back, handle_ou...
Compute the sum of elements along segments of an array. Segments are defined by an integer array of segment IDs. Parameters ---------- data The array from which to gather values. segment_ids Must be in the same size with the first dimension of `data`. Has to be of integer data type. The index-th element of `segment_ids...
148,493
from typing import Union, Tuple, Optional, Sequence, Iterable, Generator import warnings import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( outputs_to_ivy_arrays, handle_nestable, to_native_arrays_and_back, handle_ou...
Generate a Blackman window. The Blackman window is a taper formed by using the first three terms of a summation of cosines. It was designed to have close to the minimal leakage possible. It is close to optimal, only slightly worse than a Kaiser window. Parameters ---------- window_length the window_length of the return...
148,494
from typing import Union, Tuple, Optional, Sequence, Iterable, Generator import warnings import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( outputs_to_ivy_arrays, handle_nestable, to_native_arrays_and_back, handle_ou...
Generate a random Tucker tensor. Parameters ---------- shape shape of the tensor to generate rank rank of the Tucker decomposition if int, the same rank is used for each mode otherwise, dimension of each mode full if True, a full tensor is returned otherwise, the decomposed tensor is returned orthogonal if True, create...
148,495
from typing import Union, Tuple, Optional, Sequence, Iterable, Generator import warnings import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( outputs_to_ivy_arrays, handle_nestable, to_native_arrays_and_back, handle_ou...
Generate a random TR tensor. Parameters ---------- shape : tuple shape of the tensor to generate rank : Sequence[int] rank of the TR decomposition must verify rank[0] == rank[-1] (boundary conditions) and len(rank) == len(shape)+1 full : bool, optional, default is False if True, a full tensor is returned otherwise, the...
148,496
from typing import Union, Tuple, Optional, Sequence, Iterable, Generator import warnings import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( outputs_to_ivy_arrays, handle_nestable, to_native_arrays_and_back, handle_ou...
Generate a random PARAFAC2 tensor. Parameters ---------- shapes A shapes of the tensor to generate rank rank of the Parafac2 decomposition full if True, a full tensor is returned otherwise, the decomposed tensor is returned seed seed for generating random numbers Returns ------- ivy.Parafac2Tensor
148,497
from typing import Union, Tuple, Optional, Sequence, Iterable, Generator import warnings import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( outputs_to_ivy_arrays, handle_nestable, to_native_arrays_and_back, handle_ou...
Generate a random TT/MPS tensor. Parameters ---------- shape shape of the tensor to generate rank rank of the TT decomposition must verify rank[0] == rank[-1] ==1 (boundary conditions) and len(rank) == len(shape)+1 full if True, a full tensor is returned otherwise, the decomposed tensor is returned seed seed for genera...
148,498
from typing import Union, Tuple, Optional, Sequence, Iterable, Generator import warnings import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( outputs_to_ivy_arrays, handle_nestable, to_native_arrays_and_back, handle_ou...
Return the upper or lower triangular part of a matrix (or a stack of matrices) ``x``. note:: The upper triangular part of the matrix is defined as the elements on and above the specified diagonal ``k``. The lower triangular part of the matrix is defined as the elements on and below the specified diagonal ``k``. Paramet...
148,499
from typing import Union, Tuple, Optional, Sequence, Iterable, Generator import warnings import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( outputs_to_ivy_arrays, handle_nestable, to_native_arrays_and_back, handle_ou...
Generate a MelWeightMatrix that can be used to re-weight a Tensor containing a linearly sampled frequency spectra (from DFT or STFT) into num_mel_bins frequency information based on the [lower_edge_hertz, upper_edge_hertz] range on the mel scale. This function defines the mel scale in terms of a frequency in hertz acco...
148,500
from typing import Union, Tuple, Optional, Sequence, Iterable, Generator import warnings import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( outputs_to_ivy_arrays, handle_nestable, to_native_arrays_and_back, handle_ou...
Compute the mean of elements along segments of an array. Segments are defined by an integer array of segment IDs. Parameters ---------- data : Union[ivy.Array, ivy.NativeArray] The array from which to gather values. segment_ids : Union[ivy.Array, ivy.NativeArray] Must be in the same size with the first dimension of `da...
148,501
from typing import Union, Tuple, Optional, Sequence, Iterable, Generator import warnings import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( outputs_to_ivy_arrays, handle_nestable, to_native_arrays_and_back, handle_ou...
Evaluate and return a polynomial at specific given values. Parameters ---------- coeffs Polynomial coefficients (including zero) from highest degree to constant term. x The value of the indeterminate variable at which to evaluate the polynomial. Returns ------- ret Simplified result of substituting x in the coefficient...
148,502
from typing import Optional, Union, Tuple, Sequence import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_array_like_without_promotion, handle_nestable, infer_dtype, handle_device, handle_backend_invalid, ) from ivy.utils....
Compute the histogram of the array ``a``. .. note:: Given bins = [c0, ..., cK], defining intervals I0 = [c0, c1), I1 = [c1, c2), ..., I_{K-1} = [c_{K-1}, cK]. Parameters ---------- a input array. bins if ``bins`` is an int, it defines the number of equal-width bins in the given range. if ``bins`` is an array, it define...
148,503
from typing import Optional, Union, Tuple, Sequence import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_array_like_without_promotion, handle_nestable, infer_dtype, handle_device, handle_backend_invalid, ) from ivy.utils....
Compute the median along the specified axis. Parameters ---------- input Input array. axis Axis or axes along which the medians are computed. The default is to compute the median along a flattened version of the array. keepdims If this is set to True, the axes which are reduced are left in the result as dimensions with...
148,504
from typing import Optional, Union, Tuple, Sequence import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_array_like_without_promotion, handle_nestable, infer_dtype, handle_device, handle_backend_invalid, ) from ivy.utils....
Compute the mean of all non-NaN elements along the specified dimensions. Parameters ---------- a Input array. axis Axis or axes along which the means are computed. The default is to compute the mean of the flattened array. keepdims If this is set to True, the axes which are reduced are left in the result as dimensions ...
148,505
from typing import Optional, Union, Tuple, Sequence import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_array_like_without_promotion, handle_nestable, infer_dtype, handle_device, handle_backend_invalid, ) from ivy.utils....
Return minimum of an array or minimum along an axis, ignoring any NaNs. Parameters ---------- a Input array. axis Axis or axes along which the minimum is computed. The default is to compute the minimum of the flattened array. out optional output array, for writing the result to. keepdims If this is set to True, the axe...
148,506
from typing import Optional, Union, Tuple, Sequence import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_array_like_without_promotion, handle_nestable, infer_dtype, handle_device, handle_backend_invalid, ) from ivy.utils....
Compute the product of array elements over a given axis treating Not a Numbers (NaNs) as ones. Parameters ---------- a Input array. axis Axis or axes along which the product is computed. The default is to compute the product of the flattened array. dtype The desired data type of returned array. Default is None. out opt...
148,507
from typing import Optional, Union, Tuple, Sequence import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_array_like_without_promotion, handle_nestable, infer_dtype, handle_device, handle_backend_invalid, ) from ivy.utils....
Compute the q-th quantile of the data along the specified axis. Parameters ---------- a Input array. q Quantile or sequence of quantiles to compute, which must be between 0 and 1 inclusive. axis Axis or axes along which the quantiles are computed. The default is to compute the quantile(s) along a flattened version of t...
148,508
from typing import Optional, Union, Tuple, Sequence import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_array_like_without_promotion, handle_nestable, infer_dtype, handle_device, handle_backend_invalid, ) from ivy.utils....
null
148,509
from typing import Optional, Union, Tuple, Sequence import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_array_like_without_promotion, handle_nestable, infer_dtype, handle_device, handle_backend_invalid, ) from ivy.utils....
ivy.Array instance method variant of ivy.nanmedian. This method simply wraps the function, and so the docstring for ivy.nanmedian also applies to this method with minimal changes. Parameters ---------- self Input array. axis Axis or axes along which the means are computed. The default is to compute the mean of the flat...
148,510
from typing import Optional, Union, Tuple, Sequence import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_array_like_without_promotion, handle_nestable, infer_dtype, handle_device, handle_backend_invalid, ) from ivy.utils....
Count the number of occurrences of each value in an integer array. Parameters ---------- self Input array. weights An optional input array. minlength A minimum number of bins for the output array. Returns ------- ret The bincount of the array elements. Examples -------- >>> a = ivy.Container([[10.0, ivy.nan, 4], [3, 2,...
148,511
from typing import Optional, Union, Tuple, Sequence import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_array_like_without_promotion, handle_nestable, infer_dtype, handle_device, handle_backend_invalid, ) from ivy.utils....
Compute the regularized lower gamma function of ``a`` and ``x``. Parameters ---------- self Input array. x An additional input array. `x` has the same type as `a`. out optional output array, for writing the result to. Returns ------- ret The lower incomplete gamma function of the array elements. Examples -------- >>> a...
148,512
from typing import Optional, Union, Tuple, Sequence import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_array_like_without_promotion, handle_nestable, infer_dtype, handle_device, handle_backend_invalid, ) from ivy.utils....
Compute the covariance of matrix x1, or variables x1 and x2. Parameters ---------- x1 a 1D or 2D input array, with a numeric data type. x2 optional second 1D or 2D input array, with a numeric data type. Must have the same shape as ``self``. rowVar optional variable where each row of input is interpreted as a variable (...
148,513
from typing import Optional, Union, Tuple, Sequence import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_array_like_without_promotion, handle_nestable, infer_dtype, handle_device, handle_backend_invalid, ) from ivy.utils....
Return a tuple containing the cumulative maximum of elements of input along the given axis and index location of each maximum value found along the given axis. Parameters ---------- x Input array. axis Axis along which the cumulative maximum is computed. Default is ``0``. exclusive Whether to perform cummax exclusively...
148,514
from typing import Optional, Union, Tuple, Sequence import ivy from ivy.func_wrapper import ( handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_array_like_without_promotion, handle_nestable, infer_dtype, handle_device, handle_backend_invalid, ) from ivy.utils....
Return the cumulative minimum of the elements along a given axis. Parameters ---------- x Input array. axis Axis along which the cumulative minimum is computed. Default is ``0``. reverse Whether to perform the cummin from last to first element in the selected axis. Default is ``False`` (from first to last element) dtyp...
148,515
from typing import Optional import ivy from ivy import handle_out_argument, handle_nestable from ivy.utils.exceptions import handle_exceptions The provided code snippet includes necessary dependencies for implementing the `optional_get_element` function. Write a Python function `def optional_get_element( x: Option...
If the input is a tensor or sequence type, it returns the input. If the input is an optional type, it outputs the element in the input. It is an error if the input is an empty optional-type (i.e. does not have an element) and the behavior is undefined in this case. Parameters ---------- x Input array out Optional outpu...
148,516
from typing import Union, Optional import ivy from ivy.func_wrapper import ( handle_nestable, inputs_to_ivy_arrays, handle_array_like_without_promotion, handle_array_function, to_native_arrays_and_back, ) from ivy.utils.exceptions import handle_exceptions The provided code snippet includes necessar...
Compute the log-likelihood loss between the prediction and the target under the assumption that the target has a Poisson distribution. Caveat: By default, this is not the exact loss, but the loss minus a constant term [log(z!)]. That has no effect for optimization, but does not play well with relative loss comparisons....
148,517
from typing import Union, Optional import ivy from ivy.func_wrapper import ( handle_nestable, inputs_to_ivy_arrays, handle_array_like_without_promotion, handle_array_function, to_native_arrays_and_back, ) from ivy.utils.exceptions import handle_exceptions The provided code snippet includes necessar...
Compute L1 loss (Mean Absolute Error - MAE) between targeticted and input values. Parameters ---------- input : Union[ivy.Array, ivy.NativeArray] Input array containing input values. target : Union[ivy.Array, ivy.NativeArray] Input array containing targeted values. reduction : str, optional Reduction method for the out...
148,518
from typing import Union, Optional import ivy from ivy.func_wrapper import ( handle_nestable, inputs_to_ivy_arrays, handle_array_like_without_promotion, handle_array_function, to_native_arrays_and_back, ) from ivy.utils.exceptions import handle_exceptions The provided code snippet includes necessar...
Compute the Huber loss (smooth L1 loss) between true and predicted values. Parameters ---------- true: array_like The true (ground truth) values. pred : array_like The predicted values by the model. delta : float, optional The threshold parameter that determines the point where the loss transitions fro -m squared error...
148,519
from typing import Union, Optional import ivy from ivy.func_wrapper import ( handle_nestable, inputs_to_ivy_arrays, handle_array_like_without_promotion, handle_array_function, to_native_arrays_and_back, ) from ivy.utils.exceptions import handle_exceptions The provided code snippet includes necessar...
Compute the smooth L1 loss between two input tensors. Parameters ---------- input : array_like First input tensor. target : array_like Second input tensor. beta : float, optional The smooth parameter. Default is 1.0. reduction : str, optional Specifies the type of reduction to apply to the output. Should be one of 'non...
148,520
from typing import Union, Optional import ivy from ivy.func_wrapper import ( handle_nestable, inputs_to_ivy_arrays, handle_array_like_without_promotion, handle_array_function, to_native_arrays_and_back, ) from ivy.utils.exceptions import handle_exceptions The provided code snippet includes necessar...
Compute the soft-margin hinge loss between predicted scores and true binary labels. Parameters ---------- input : array_like True binary labels, of shape (batch_size,). target : array_like Predicted scores, of shape (batch_size,). reduction : {'mean', 'sum', 'none'}, optional Type of reduction to apply to the output. D...
148,521
from typing import Union, Optional import ivy from ivy.func_wrapper import ( handle_nestable, inputs_to_ivy_arrays, handle_array_like_without_promotion, handle_array_function, to_native_arrays_and_back, ) from ivy.utils.exceptions import handle_exceptions The provided code snippet includes necessar...
Compute the Kullback-Leibler divergence loss between two input tensors (conventionally, probability distributions). Parameters ---------- input : array_like Tensor of arbitrary shape in log-probabilities target : array_like Tensor of the same shape as input. See log_target for the target’s interpretation reduction : {'...
148,522
from typing import Union, Optional import ivy from ivy.func_wrapper import ( handle_nestable, inputs_to_ivy_arrays, handle_array_like_without_promotion, handle_array_function, to_native_arrays_and_back, ) from ivy.utils.exceptions import handle_exceptions The provided code snippet includes necessar...
r"""Compute the Poisson Negative Log Likelihood Loss. This function calculates the negative log likelihood loss between the `input` and `target`under the assumption that the target follows a Poisson distribution. By default, the loss is not the exact loss, but the loss minus a constant term [log(z!)]. This omission doe...
148,523
from typing import Union, Optional import ivy from ivy.func_wrapper import ( handle_nestable, inputs_to_ivy_arrays, handle_array_like_without_promotion, handle_array_function, to_native_arrays_and_back, ) from ivy.utils.exceptions import handle_exceptions The provided code snippet includes necessar...
r"""Measures loss from input `x` and label `y` with values 1 or -1. It evaluates if two inputs are similar or not, often used for embedding or semi-supervised learning. Loss for the `n`-th sample: .. math:: l_n = \begin{cases} x_n, & \text{if}\; y_n = 1,\\ \max \{0, margin - x_n\}, & \text{if}\; y_n = -1, \end{cases} T...
148,524
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
null
148,525
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
Compute the logit of x. logit(x) = log(x / (1 - x)). Parameters ---------- x Input data. eps When eps is None the function outputs NaN where x < 0 or x > 1. and inf or -inf where x = 1 or x = 0, respectively. Otherwise if eps is defined, x is clamped to [eps, 1 - eps] complex_mode optional specifier for how to handle c...
148,526
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
Prelu takes input data (Array) and slope array as input, and produces one output data (array) where the function f(x) = slope * x for x < 0, f(x) = x for x >= 0., is applied to the data array elementwise. This operator supports unidirectional broadcasting (array slope should be unidirectional broadcastable to input ten...
148,527
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
Apply the rectified linear unit function with custom threshold. Parameters ---------- x input array threshold threshold value above which the activation is linear. Default: ``0``. out optional output array, for writing the result to. It must have a shape that the inputs broadcast to. Returns ------- ret an array contai...
148,528
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
null
148,529
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
Apply the rectified linear unit 6 function element-wise. Parameters ---------- x input array complex_mode optional specifier for how to handle complex data types. See ``ivy.func_wrapper.handle_complex_input`` for more detail. out optional output array, for writing the result to. It must have a shape that the inputs bro...
148,530
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
Apply element-wise Log-sigmoid of x. logsigmoid(x) = log(1 / (1 + exp(-x)). Parameters ---------- input Input array. complex_mode optional specifier for how to handle complex data types. See ``ivy.func_wrapper.handle_complex_input`` for more detail. Returns ------- Array with same shape as input with Log-sigmoid applie...
148,531
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
Apply the scaled exponential linear unit function 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 an array containing the scaled exponential linear unit activation of each element in ``x``. Exa...
148,532
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
Apply the silu function 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 an array containing the silu activation of each element in ``x``. Examples -------- With :class:`ivy.Array` input: >>> x...
148,533
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
Apply the elu unit function element-wise. Parameters ---------- x Input array. alpha scaler for controlling the slope of the function for x <= 0 Default: 1.0 out optional output array, for writing the result to. It must have a shape that the inputs broadcast to. Returns ------- ret The input array with elu applied elem...
148,534
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
Apply the hardtanh unit function element-wise. Parameters ---------- x Input array. min_val minimum value of the linear region range. Default: -1. max_val maximum value of the linear region range. Default: 1. out optional output array, for writing the result to. It must have a shape that the inputs broadcast to. Return...
148,535
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
Apply the tanhshrink function 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 an array containing the tanhshrink activation of each element in ``x``. Examples -------- With :class:`ivy.Array` ...
148,536
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
Apply the softshrink function element-wise. Parameters ---------- x input array. lambd the value of the lower bound of the linear region range. 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 softshrink activation of ea...
148,537
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
null
148,538
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
Apply the threshold function element-wise. Parameters ---------- x input array. threshold The value to threshold at. value The value to replace with. 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 threshold activation ...
148,539
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
Apply the Continuously Differentiable Exponential Linear Unit (CELU) activation function to each element of the input. Parameters ---------- x Input array. alpha The alpha value (negative slope) for the CELU formulation. Default is ``1.0`` complex_mode optional specifier for how to handle complex data types. See ``ivy....
148,540
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
Compute the scaled hyperbolic tangent (tanh) activation. The scaled tanh activation function is defined as: out = alpha * tanh(beta * x) Parameters ---------- x input array. alpha The scaling parameter for the output. Determines the amplitude of the tanh function. Default: 1.7159 beta The scaling parameter for the inpu...
148,541
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
Apply the hardshrink function element-wise. Parameters ---------- x input array. lambd the value for the Hardshrink formulation. 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 hardshrink activation of each element in `...
148,542
from typing import Union, Optional, Callable, Literal import ivy from ivy.utils.backend import current_backend from ivy.utils.exceptions import handle_exceptions from ivy.func_wrapper import ( handle_array_function, handle_nestable, to_native_arrays_and_back, handle_array_like_without_promotion, han...
Apply the hardsilu/hardswish function 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 ------- an array containing the output of the hardsilu/hardswish function applied to each element in ``x``. Examples --...
148,543
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Compute the Heaviside step function for each element in x1. Parameters ---------- x1 input array. x2 values to use where x1 is zero. out optional output array, for writing the result to. Returns ------- ret output array with element-wise Heaviside step function of x1. This is a scalar if both x1 and x2 are scalars. Exa...
148,544
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Flip array in the up/down direction. Flip the entries in each column in the up/down direction. Rows are preserved, but appear in a different order than before. Parameters ---------- m The array to be flipped. copy boolean indicating whether or not to copy the input array. If True, the function must always copy. If Fals...
148,545
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Stack arrays in sequence vertically (row wise). Parameters ---------- arrays Sequence of arrays to be stacked. Returns ------- ret The array formed by stacking the given arrays. Examples -------- >>> x = ivy.array([1, 2, 3]) >>> y = ivy.array([2, 3, 4]) >>> ivy.vstack((x, y)) ivy.array([[1, 2, 3], [2, 3, 4]]) >>> ivy.v...
148,546
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Rotate an array by 90 degrees in the plane specified by axes. Rotation direction is from the first towards the second axis. Parameters ---------- m Input array of two or more dimensions. copy boolean indicating whether or not to copy the input array. If True, the function must always copy. If False, the function must n...
148,547
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Return the `k` largest elements of the given input array along a given axis. Parameters ---------- x The array to compute top_k for. k Number of top elements to return must not exceed the array size. axis The axis along which we must return the top elements default value is 1. largest If largest is set to False we retu...
148,548
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Flip array in the left/right direction. Flip the entries in each column in the left/right direction. Columns are preserved, but appear in a different order than before. Parameters ---------- m The array to be flipped. Must be at least 2-D. copy boolean indicating whether or not to copy the input array. If True, the fun...
148,549
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Compute the Bessel i0 function of x element-wise. Parameters ---------- x Array input. out optional output array, for writing the result to. Returns ------- ret Array with the modified Bessel function evaluated at each of the elements of x. Examples -------- >>> x = ivy.array([1, 2, 3]) >>> ivy.i0(x) ivy.array([1.26606...
148,550
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Pad an array. Parameters ---------- input Input array to pad. pad_width Number of values padded to the edges of each axis. - ((before_1, after_1), … (before_N, after_N)) yields unique pad widths for each axis. - ((before, after),) yields same before and after pad for each axis. - pad (integer) is shortcut for before = ...
148,551
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Split an array vertically into multiple sub-arrays. Parameters ---------- ary Array input. indices_or_sections If indices_or_sections is an integer n, the array is split into n equal sections, provided that n must be a divisor of the split axis. If indices_or_sections is a sequence of ints or 1-D array, then input is s...
148,552
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Split an array into multiple sub-arrays along the 3rd axis. Parameters ---------- ary Array input. indices_or_sections If indices_or_sections is an integer n, the array is split into n sections. If the array is divisible by n along the 3rd axis, each section will be of equal size. If input is not divisible by n, the si...
148,553
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Convert inputs to arrays with at least one dimension. Scalar inputs are converted to 1-dimensional arrays, whilst higher-dimensional inputs are preserved. Parameters ---------- arys One or more input arrays. copy boolean indicating whether or not to copy the input array. If True, the function must always copy. If False...
148,554
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Stack arrays in sequence depth wise (along third axis). Parameters ---------- arrays Sequence of arrays to be stacked. Returns ------- ret The array formed by stacking the given arrays. Examples -------- >>> x = ivy.array([1, 2, 3]) >>> y = ivy.array([2, 3, 4]) >>> ivy.dstack((x, y)) ivy.array([[[1, 2], [2, 3], [3, 4]]...
148,555
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Convert inputs to arrays with at least three dimension. Scalar inputs are converted to 3-dimensional arrays, whilst higher-dimensional inputs are preserved. Parameters ---------- arys One or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have three or more dimensions are preser...
148,556
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Split an array into multiple sub-arrays horizontally. Parameters ---------- ary Array input. indices_or_sections If indices_or_sections is an integer n, the array is split into n equal sections, provided that n must be a divisor of the split axis. If indices_or_sections is a tuple of ints, then input is split at each o...
148,557
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Broadcasts shapes. Parameters ---------- shapes The shapes to broadcast. Returns ------- ret The broadcasted shape. Examples -------- >>> x = [(3, 3), (3, 1)] >>> print(ivy.broadcast_shapes(*x)) (3, 3) >>> print(ivy.broadcast_shapes(*[(3, 3),(3, 1),(1, 3)])) (3, 3)
148,558
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Broadcast the input Array following the given shape and the broadcast rule. Parameters ---------- x Array input. shape A 1-D Array indicates the shape you want to expand to, following the broadcast rule. copy boolean indicating whether or not to copy the input array. If True, the function must always copy. If False, th...
148,559
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Put values into the input array by matching 1d index and data slices along a specified axis. Parameters ---------- arr : array_like The input array to modify. indices : array_like The indices of the values to put into `arr`. values : array_like The values to put into `arr`. axis : int The axis over which to put the `va...
148,560
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Create a copy of the input array with the given shape and strides. Parameters ---------- x Input Array. shape The shape of the new array. strides The strides of the new array (specified in bytes). Returns ------- ret Output Array Examples -------- >>> x = ivy.array([1, 2, 3, 4, 5, 6]) >>> ivy.as_strided(x, (4, 3), (8, ...
148,561
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Concatenate a sequence of arrays along a new or an existing axis. Parameters ---------- input_sequence A sequence of arrays. new_axis Insert and concatenate on a new axis or not, default 0 means do not insert new axis. new_axis = 0: concatenate new_axis = 1: stack axis axis along which the arrays will be concatenated. ...
148,562
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Perform an associative scan over the given array. Parameters ---------- x The array to scan over. fn The associative function to apply. reverse Whether to scan in reverse with respect to the given axis. axis The axis to scan over. Returns ------- ret The result of the scan.
148,563
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Eliminates all but the first element from every consecutive group of equivalent elements in ``x``. Parameters ---------- x input array. axis the axis to apply unique on. If None, unique is applied on flattened ``x``. Returns ------- ret a namedtuple ``(output, inverse_indices, counts)`` whose - first element has the fi...
148,564
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Fill the main diagonal of the given array of any dimensionality.. Parameters ---------- a Array at least 2D. v Value(s) to write on the diagonal. If val is scalar, the value is written along the diagonal. If array-like, the flattened val is written along the diagonal, repeating if necessary to fill all diagonal entries...
148,565
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Return the mode-`mode` unfolding of `tensor` with modes starting at `0`. Parameters ---------- x input tensor to be unfolded mode indexing starts at 0, therefore mode is in ``range(0, tensor.ndim)`` out optional output array, for writing the result to. Returns ------- ret unfolded_tensor of shape ``(tensor.shape[mode],...
148,566
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Refolds the mode-`mode` unfolding into a tensor of shape `shape` In other words, refolds the n-mode unfolded tensor into the original tensor of the specified shape. Parameters ---------- input unfolded tensor of shape ``(shape[mode], -1)`` mode the mode of the unfolding shape shape of the original tensor before unfoldi...
148,567
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Partial vectorization of a tensor while ignoring the specified dimension at the beginning and the end. Parameters ---------- x tensor to partially vectorise skip_begin number of dimensions to leave untouched at the beginning skip_end number of dimensions to leave untouched at the end out optional output array, for writ...
148,568
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Refolds a partially vectorised tensor into a full one. Parameters ---------- x a partially vectorised tensor shape the shape of the original full tensor (including skipped dimensions) skip_begin number of dimensions to leave untouched at the beginning out optional output array, for writing the result to. Returns ------...
148,569
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Matricizes the given tensor. Parameters ---------- x the input tensor row_modes modes to use as row of the matrix (in the desired order) column_modes modes to use as column of the matrix, in the desired order if None, the modes not in `row_modes` will be used in ascending order out optional output array, for writing th...
148,570
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Soft-thresholding operator. sign(tensor) * max[abs(tensor) - threshold, 0] Parameters ---------- x input array threshold float or array with shape tensor.shape * If float the threshold is applied to the whole tensor * If array, one threshold is applied per elements, 0 values are ignored out optional output array, for w...
148,571
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Take values from the input array by matching 1d index and data slices. Parameters ---------- arr The source array. choices The indices of the values to extract. out The output array. mode One of: 'wrap', 'clip'. Parameter controlling how out-of-bounds indices will be handled. Returns ------- ret The returned array has ...
148,572
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Create a new array by horizontally stacking the arrays in arrays. Equivalent to `ivy.hstack(arrays)`, except each zero or one dimensional array `x` in arrays is first reshaped into a `(x.size(), 1)` column before being stacked horizontally. Parameters ---------- arrays Arrays to be stacked. out Output array. Returns --...
148,573
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
ivy.Container instance method variant of ivy.trim_zeros. This method simply wraps the function, and so the docstring for ivy.trim_zeros also applies to this method with minimal changes. Parameters ---------- a : 1-D array Input array. trim : str, optional A string with 'f' representing trim from front and 'b' to trim f...
148,574
from typing import ( Optional, Union, Tuple, Iterable, Sequence, Callable, Any, Literal, List, ) from numbers import Number from functools import partial import math import ivy from ivy.func_wrapper import ( handle_out_argument, handle_partial_mixed_function, to_native_ar...
Expand a dimension of the input tensor over multiple dimensions. Parameters ---------- x input tensor. dim dimension to be unflattened, specified as an index into input.shape. shape new shape of the unflattened dimension. One of its elements can be -1 in which case the corresponding output dimension is inferred. Otherw...
148,575
from typing import Optional, Union, Tuple, List, Sequence from numbers import Number import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_partial_mixed_function, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_arr...
Calculate the maximum value of the input array ``x``. .. note:: ``amax`` is an alias of ``max`` and both function behaves similarly in every backend except PyTorch and PaddlePaddle (see `PyTorch's amax function documentation<https://pytorch.org/docs/stable/generated/torch.amax.html>`_`) (see `PaddlePaddle's amax functi...
148,576
from typing import Optional, Union, Tuple, List, Sequence from numbers import Number import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_partial_mixed_function, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_arr...
Calculate the minimum value of the input array ``x``. .. note:: ``amin`` is an alias of ``min`` and both function behaves similarly in every backend except PyTorch and PaddlePaddle (see `PyTorch's amin function documentation<https://pytorch.org/docs/stable/generated/torch.amin.html>`_`) (see `PaddlePaddle's amin functi...
148,577
from typing import Optional, Union, Tuple, List, Sequence from numbers import Number import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_partial_mixed_function, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_arr...
Compute the natural logarithm of the absolute value of the gamma function on x. Parameters ---------- x input array. Should have a floating-point 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 natural log of...
148,578
from typing import Optional, Union, Tuple, List, Sequence from numbers import Number import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_partial_mixed_function, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_arr...
Calculate an implementation-dependent approximation of the principal value of the normalized sinc function, having domain ``(-infinity, +infinity)`` and codomain ``[-0.217234, 1]``, for each element ``x_i`` of the input array ``x``. Each element ``x_i`` is assumed to be expressed in radians. **Special cases** For float...
148,579
from typing import Optional, Union, Tuple, List, Sequence from numbers import Number import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_partial_mixed_function, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_arr...
Compute the element-wise maximums of two arrays. Differs from ivy.maximum in the case where one of the elements is NaN. ivy.maximum returns the NaN element while ivy.fmax returns the non-NaN element. Parameters ---------- x1 First input array. x2 Second input array. out optional output array, for writing the result to....
148,580
from typing import Optional, Union, Tuple, List, Sequence from numbers import Number import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_partial_mixed_function, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_arr...
Raise each base in x1 to the positionally-corresponding power in x2. x1 and x2 must be broadcastable to the same shape. This differs from the power function in that integers, float16, and float32 are promoted to floats with a minimum precision of float64 so that the result is always inexact. Parameters ---------- x1 Ar...
148,581
from typing import Optional, Union, Tuple, List, Sequence from numbers import Number import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_partial_mixed_function, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_arr...
Change the signs of x1 to match x2 x1 and x2 must be broadcastable to a common shape. Parameters ---------- x1 Array or scalar to change the sign of x2 Array or scalar from which the new signs are applied Unsigned zeroes are considered positive. out optional output array, for writing the result to. Returns ------- ret ...
148,582
from typing import Optional, Union, Tuple, List, Sequence from numbers import Number import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_partial_mixed_function, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_arr...
Count the number of non-zero values in the array a. Parameters ---------- a array for which to count non-zeros. axis optional axis or tuple of axes along which to count non-zeros. Default is None, meaning that non-zeros will be counted along a flattened version of the input array. keepdims optional, if this is set to T...
148,583
from typing import Optional, Union, Tuple, List, Sequence from numbers import Number import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_partial_mixed_function, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_arr...
Return the sum of array elements over a given axis treating Not a Numbers (NaNs) as zero. Parameters ---------- x Input array. axis Axis or axes along which the sum is computed. The default is to compute the sum of the flattened array. dtype The type of the returned array and of the accumulator in which the elements ar...
148,584
from typing import Optional, Union, Tuple, List, Sequence from numbers import Number import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_partial_mixed_function, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_arr...
Return a boolean array where two arrays are element-wise equal within a tolerance. The tolerance values are positive, typically very small numbers. The relative difference (rtol * abs(b)) and the absolute difference atol are added together to compare against the absolute difference between a and b. The default atol is ...
148,585
from typing import Optional, Union, Tuple, List, Sequence from numbers import Number import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_partial_mixed_function, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_arr...
Return element-wise True where signbit is set (less than zero). Parameters ---------- x Array-like input. out optional output array, for writing the result to. Returns ------- ret Output array, or reference to out if that was supplied. This is a scalar if x is a scalar. Examples -------- >>> x = ivy.array([1, -2, 3]) >...
148,586
from typing import Optional, Union, Tuple, List, Sequence from numbers import Number import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_partial_mixed_function, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_arr...
Return the hypotenuse given the two sides of a right angle triangle. Parameters ---------- x1 The first input array x2 The second input array Returns ------- ret An array with the hypotenuse Examples -------- >>> a = ivy.array([3.0, 4.0, 5.0]) >>> b = ivy.array([4.0, 5.0, 6.0]) >>> ivy.hypot(a, b) ivy.array([5.0, 6.403...
148,587
from typing import Optional, Union, Tuple, List, Sequence from numbers import Number import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_partial_mixed_function, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_arr...
Return the n-th discrete difference along the given axis. Parameters ---------- x Array-like input. n The number of times values are differenced. If zero, the input is returned as-is. axis The axis along which the difference is taken, default is the last axis. prepend,append Values to prepend/append to x along given ax...
148,588
from typing import Optional, Union, Tuple, List, Sequence from numbers import Number import ivy from ivy.func_wrapper import ( handle_out_argument, to_native_arrays_and_back, handle_nestable, handle_partial_mixed_function, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_arr...
Return a True if the two arrays are element-wise equal within given tolerance; otherwise False. The tolerance values are positive, typically very small numbers. The relative difference (rtol * abs(x2)) and the absolute difference atol are added together to compare against the absolute difference between x1 and x2. The ...