id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
147,689
import ivy from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, outputs_to_native_arrays, ) from ivy.func_wrapper import outputs_to_ivy_arrays from ivy.functional.frontends import set_frontend_to_specific_version if ivy.is_local(): module = ivy.utils._importlib.import_cache[_...
null
147,690
jax_enable_x64 = False def update(value, toggle): global jax_enable_x64 if value == "jax_enable_x64": jax_enable_x64 = toggle
null
147,691
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) from ivy.functional.frontends import set_frontend_to_specific_version if ivy.is_local(): module = iv...
null
147,692
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) def _get_seed(key): if "PRNGKeyArray" in repr(key): key = key._base_array key1, key2 = int(ke...
null
147,693
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) def _get_seed(key): from ivy.functional.frontends import set_frontend_to_specific_version if ivy.is_loca...
null
147,694
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) def _remove_axis(shape, axis): def gumbel(key, shape=(), dtype="float64"): from ivy.functional.frontends imp...
null
147,695
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) def _get_seed(key): if "PRNGKeyArray" in repr(key): key = key._base_array key1, key2 = int(ke...
null
147,696
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) def _get_seed(key): if "PRNGKeyArray" in repr(key): key = key._base_array key1, key2 = int(ke...
null
147,697
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) def maxwell(key, shape, dtype="float64"): def rademacher(key, shape, dtype="int64"): from ivy.functional.fro...
null
147,698
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) def _get_seed(key): if "PRNGKeyArray" in repr(key): key = key._base_array key1, key2 = int(ke...
null
147,699
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) from ivy.functional.frontends import set_frontend_to_specific_version if ivy.is_local(): module = iv...
null
147,700
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) def _get_seed(key): if "PRNGKeyArray" in repr(key): key = key._base_array key1, key2 = int(ke...
null
147,701
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) def _get_seed(key): if "PRNGKeyArray" in repr(key): key = key._base_array key1, key2 = int(ke...
null
147,702
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) def _get_seed(key): if "PRNGKeyArray" in repr(key): key = key._base_array key1, key2 = int(ke...
null
147,703
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) def normal(key, shape=(), dtype=None): seed = _get_seed(key) return ivy.random_normal(shape=shape, dt...
null
147,704
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) def _get_seed(key): if "PRNGKeyArray" in repr(key): key = key._base_array key1, key2 = int(ke...
null
147,705
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) def _get_seed(key): if "PRNGKeyArray" in repr(key): key = key._base_array key1, key2 = int(ke...
null
147,706
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) def _get_seed(key): if "PRNGKeyArray" in repr(key): key = key._base_array key1, key2 = int(ke...
null
147,707
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) def _get_seed(key): if "PRNGKeyArray" in repr(key): key = key._base_array key1, key2 = int(ke...
null
147,708
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) def _get_seed(key): if "PRNGKeyArray" in repr(key): key = key._base_array key1, key2 = int(ke...
null
147,709
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) def _get_seed(key): if "PRNGKeyArray" in repr(key): key = key._base_array key1, key2 = int(ke...
null
147,710
import operator import ivy from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes from ivy.functional.frontends.jax.func_wrapper import ( to_ivy_arrays_and_back, handle_jax_dtype, ) def _get_seed(key): from ivy.functional.frontends import set_frontend_to_specific_version if ivy.is_loca...
null
147,711
import ivy from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back import ivy.functional.frontends.scipy as sc_frontend def minkowski(u, v, p=2, /, *, w=None): u = _validate_vector(u) v = _validate_vector(v) if p <= 0: raise ValueError("p must be greater than 0") u_v = u -...
null
147,712
import ivy from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back def _check_finite(a): if not ivy.all(ivy.isfinite(a)): raise ValueError("Array must not contain infs or NaNs") def eigh_tridiagonal( d, e, /, *, eigvals_only=False, select="a", select_range...
null
147,713
import ivy from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back def _check_finite(a): if not ivy.all(ivy.isfinite(a)): raise ValueError("Array must not contain infs or NaNs") def inv(a, /, *, overwrite_a=False, check_finite=True): if check_finite: _check_finite(a) ...
null
147,714
import ivy from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back def kron(a, b): return ivy.kron(a, b)
null
147,715
import ivy from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back def _check_finite(a): def lu_factor(a, /, *, overwrite_a=False, check_finite=True): if check_finite: _check_finite(a) return ivy.lu_factor(a)
null
147,716
import ivy from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back def _check_finite(a): if not ivy.all(ivy.isfinite(a)): raise ValueError("Array must not contain infs or NaNs") def norm(a, /, *, ord=None, axis=None, keepdims=False, check_finite=True): if check_finite: _c...
null
147,717
import ivy from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back def _check_finite(a): if not ivy.all(ivy.isfinite(a)): raise ValueError("Array must not contain infs or NaNs") def pinv( a, /, *, atol=None, rtol=None, return_rank=False, cond=None, rco...
null
147,718
import ivy from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back def _check_finite(a): if not ivy.all(ivy.isfinite(a)): raise ValueError("Array must not contain infs or NaNs") def svd( a, /, *, full_matrices=True, compute_uv=True, overwrite_a=False, check_finite=True ): if ...
null
147,719
import ivy from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back def _check_finite(a): if not ivy.all(ivy.isfinite(a)): raise ValueError("Array must not contain infs or NaNs") def svdvals(a, /, *, overwrite_a=False, check_finite=True): if check_finite: _check_finite(a) ...
null
147,720
import ivy from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back def tril(m, /, *, k=0): return ivy.tril(m, k=k)
null
147,721
import ivy from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back def triu(m, /, *, k=0): return ivy.triu(m, k=k)
null
147,722
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back import ivy def fft(x, n=None, axis=-1, norm="backward", overwrite_x=False): return ivy.fft(x, axis, norm=norm, n=n)
null
147,723
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back import ivy def fft2(x, s=None, axes=(-2, -1), norm=None, overwrite_x=False): return ivy.fft2(x, s=s, dim=axes, norm=norm)
null
147,724
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back import ivy def dct(x, type=2, n=None, axis=-1, norm=None, overwrite_x=False, orthogonalize=None): return ivy.dct(x, type=type, n=n, axis=axis, norm=norm) def idct(x, type=2, n=None, axis=-1, norm=None, overwrite_x=False, orthogonalize=N...
null
147,725
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back import ivy def ifft(x, n=None, axis=-1, norm=None, overwrite_x=False): return ivy.ifft(x, axis, norm=norm, n=n)
null
147,726
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back import ivy def ifftn( x, s=None, axes=None, norm=None, overwrite_x=False, workers=None, *, plan=None ): return ivy.ifftn(x, s=s, axes=axes, norm=norm)
null
147,727
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back import ivy def rfftn( x, s=None, axes=None, norm=None, overwrite_x=False, workers=None, *, plan=None ): return ivy.rfftn(x, s=s, axes=axes, norm=norm)
null
147,728
from functools import wraps def outputs_to_self_class(func): @wraps(func) def _outputs_to_self_class(*args, **kwargs): self_arg = args[0] return self_arg.__class__( func(*args, **kwargs), index=self_arg.index, columns=self_arg.columns, dtype=self_...
null
147,729
import ivy from ivy.functional.frontends.mxnet.func_wrapper import ( to_ivy_arrays_and_back, handle_mxnet_out, ) from ivy.functional.frontends.mxnet.numpy import promote_types_of_mxnet_inputs import ivy from ivy.utils.exceptions import handle_exceptions from ivy.functional.frontends import set_frontend_to_spec...
null
147,730
import ivy from ivy.functional.frontends.mxnet.func_wrapper import ( to_ivy_arrays_and_back, handle_mxnet_out, ) from ivy.functional.frontends.mxnet.numpy import promote_types_of_mxnet_inputs import ivy from ivy.utils.exceptions import handle_exceptions from ivy.functional.frontends import set_frontend_to_spec...
null
147,731
import ivy from ivy.functional.frontends.mxnet.func_wrapper import ( to_ivy_arrays_and_back, ) from ivy.functional.frontends.numpy.func_wrapper import handle_numpy_dtype import ivy from ivy.utils.exceptions import handle_exceptions from ivy.functional.frontends import set_frontend_to_specific_version ...
null
147,732
import ivy from ivy.functional.frontends.mxnet.func_wrapper import to_ivy_arrays_and_back import ivy from ivy.utils.exceptions import handle_exceptions from ivy.functional.frontends import set_frontend_to_specific_version from ivy.functional.frontends.numpy.mathematical_functions.miscellaneous im...
null
147,733
import ivy from ivy.functional.frontends.mxnet.func_wrapper import to_ivy_arrays_and_back import ivy from ivy.utils.exceptions import handle_exceptions from ivy.functional.frontends import set_frontend_to_specific_version from ivy.functional.frontends.numpy.mathematical_functions.miscellaneous im...
null
147,734
import ivy from ivy.functional.frontends.mxnet.func_wrapper import to_ivy_arrays_and_back def gamma(shape, scale=1.0, size=None, dtype=None, device=None, out=None): return ivy.experimental.gamma( shape, scale, shape=size, dtype=dtype, device=device, out=out ) import ivy from ivy.utils.exceptions import...
null
147,735
import ivy from ivy.functional.frontends.mxnet.func_wrapper import to_ivy_arrays_and_back import ivy from ivy.utils.exceptions import handle_exceptions from ivy.functional.frontends import set_frontend_to_specific_version from ivy.functional.frontends.numpy.mathematical_functions.miscellaneous im...
null
147,736
import ivy from ivy.functional.frontends.mxnet.func_wrapper import to_ivy_arrays_and_back import ivy from ivy.utils.exceptions import handle_exceptions from ivy.functional.frontends import set_frontend_to_specific_version from ivy.functional.frontends.numpy.mathematical_functions.miscellaneous im...
null
147,737
import ivy from ivy.functional.frontends.mxnet.func_wrapper import to_ivy_arrays_and_back def beta(a, b, size=None, dtype=None, device=None): return ivy.experimental.beta(a, b, shape=size, dtype=dtype, device=device) import ivy from ivy.utils.exceptions import handle_exceptions from ivy.functional.frontends import...
null
147,738
import ivy from ivy.functional.frontends.mxnet.func_wrapper import to_ivy_arrays_and_back import ivy from ivy.utils.exceptions import handle_exceptions from ivy.functional.frontends import set_frontend_to_specific_version from ivy.functional.frontends.numpy.mathematical_functions.miscellaneous im...
null
147,739
import ivy from ivy.functional.frontends.mxnet.func_wrapper import to_ivy_arrays_and_back import ivy from ivy.utils.exceptions import handle_exceptions from ivy.functional.frontends import set_frontend_to_specific_version from ivy.functional.frontends.numpy.mathematical_functions.miscellaneous im...
null
147,740
import ivy from ivy.functional.frontends.mxnet.func_wrapper import to_ivy_arrays_and_back import ivy from ivy.utils.exceptions import handle_exceptions from ivy.functional.frontends import set_frontend_to_specific_version from ivy.functional.frontends.numpy.mathematical_functions.miscellaneous im...
null
147,741
import ivy from ivy.functional.frontends.mxnet.func_wrapper import to_ivy_arrays_and_back import ivy from ivy.utils.exceptions import handle_exceptions from ivy.functional.frontends import set_frontend_to_specific_version from ivy.functional.frontends.numpy.mathematical_functions.miscellaneous im...
null
147,742
import ivy from ivy.functional.frontends.mxnet.func_wrapper import to_ivy_arrays_and_back from ivy.functional.frontends.numpy.func_wrapper import handle_numpy_dtype def softmax(data, length=None, axis=-1, temperature=None, use_length=False, dtype=None): ret = ivy.softmax(data, axis=axis) if dtype: ivy....
null
147,743
import functools import inspect from typing import Callable import ivy from ivy.functional.frontends.mxnet.numpy.ndarray import ndarray def handle_mxnet_out(fn: Callable) -> Callable: @functools.wraps(fn) def _handle_mxnet_out(*args, **kwargs): if "out" not in kwargs: keys = list(inspect.si...
null
147,744
import functools import inspect from typing import Callable import ivy from ivy.functional.frontends.mxnet.numpy.ndarray import ndarray def inputs_to_ivy_arrays(fn: Callable) -> Callable: def _inputs_to_ivy_arrays_mxnet(*args, **kwargs): """Convert `ndarray.NDArray` into `ivy.Array` instances. Conve...
Wrap `fn` so it receives and returns `ivy.Array` instances. Wrap `fn` so that input arrays are all converted to `ivy.Array` instances and return arrays are all converted to `ndarray.NDArray` instances.
147,745
import ivy from ivy.func_wrapper import with_unsupported_dtypes from .gbm import GBLinear def _binary_prediction(obj, raw_pred): # apply activation function pred = obj.pred_transform(raw_pred) # apply probability thresholding return ivy.where(pred >= 0.5, 1.0, 0.0)
null
147,746
from .core import Booster class Booster: def __init__(self, params=None, cache=None, model_file=None, compile=False): # cache[0] refers to input data while cache[1] refers to input target n_feat = cache[0].shape[1] n_inst = cache[0].shape[0] n_output_group = ivy.unique_values(cache[...
Train a booster with given parameters. Parameters ---------- params Booster params. dtrain Data to be trained. dlabel Training labels. num_boost_round Number of boosting iterations. evals List of validation sets for which metrics will be evaluated during training. Validation metrics will help us track the performance o...
147,747
import ivy from ivy.functional.frontends.xgboost.linear.coordinate_common import ( get_bias_gradient, coordinate_delta_bias, update_bias_residual, coordinate_delta, ) def coordinate_delta(sum_grad, sum_hess, w, reg_alpha, reg_lambda): mask = ivy.where(sum_hess < 1e-5, 0.0, 1.0) sum_grad_l2 = s...
Implements one step of coordinate descent. The original optimizer implements parallel calculations. The below code is an approximation of the original one, but rather than computing the update direction for a single parameter at a time using a for loop and cumulative gradients, it does the update in parallel by means o...
147,748
import ivy from ivy.functional.frontends.xgboost.objective.regression_loss import ( LogisticRegression, ) from ivy.functional.frontends.xgboost.linear.updater_coordinate import ( coordinate_updater, ) from copy import deepcopy def _get_gradient(obj, pred, label, scale_pos_weight): p = obj.pred_transform(pr...
null
147,749
import ivy from ivy.functional.frontends.xgboost.objective.regression_loss import ( LogisticRegression, ) from ivy.functional.frontends.xgboost.linear.updater_coordinate import ( coordinate_updater, ) from copy import deepcopy def _pred(dt, w, base): return ivy.matmul(dt, w[:-1]) + w[-1] + base
null
147,750
import functools from typing import Callable import ivy import ivy.functional.frontends.onnx as onnx_frontend def _ivy_array_to_onnx(x): if isinstance(x, ivy.Array) or ivy.is_native_array(x): return onnx_frontend.Tensor(x) return x
null
147,751
import functools from typing import Callable import ivy import ivy.functional.frontends.onnx as onnx_frontend def inputs_to_ivy_arrays(fn: Callable) -> Callable: def _inputs_to_ivy_arrays_onnx(*args, **kwargs): """Convert `Tensor` into `ivy.Array` instances. Convert all `Tensor` instances in both th...
Wrap `fn` so it receives and returns `ivy.Array` instances. Wrap `fn` so that input arrays are all converted to `ivy.Array` instances and return arrays are all converted to `ndarray.NDArray` instances.
147,752
import ivy from ivy.functional.frontends.onnx.func_wrapper import to_ivy_arrays_and_back def Abs(input): return ivy.abs(input)
null
147,753
import ivy from ivy.functional.frontends.onnx.func_wrapper import to_ivy_arrays_and_back def Acos(input): return ivy.acos(input)
null
147,754
import ivy from ivy.functional.frontends.onnx.func_wrapper import to_ivy_arrays_and_back def Acosh(input): return ivy.acosh(input)
null
147,755
import ivy from ivy.functional.frontends.onnx.func_wrapper import to_ivy_arrays_and_back def Add(x1, x2): return ivy.add(x1, x2)
null
147,756
import ivy from ivy.functional.frontends.onnx.func_wrapper import to_ivy_arrays_and_back def Asin(input): return ivy.asin(input)
null
147,757
import ivy from ivy.functional.frontends.onnx.func_wrapper import to_ivy_arrays_and_back def MatMul(x1, x2): return ivy.matmul(x1, x2)
null
147,758
from ivy.functional.frontends.onnx.proto import NodeProto from ivy_tests.test_ivy.helpers.testing_helpers import _import_fn class NodeProto: def __init__(self): self._fn = None self._fn_mod = None self._fn_name = None self.input = None self.output = None self.name = ...
null
147,759
import ivy from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.func_wrapper import with_supported_dtypes, with_unsupported_device_and_dtypes def nms(boxes, scores, iou_threshold): return ivy.nms(boxes, scores, iou_threshold) import ivy.functional.frontends.torch as torch import ...
null
147,760
import ivy from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.func_wrapper import with_supported_dtypes, with_unsupported_device_and_dtypes def box_area(boxes): return ivy.prod(boxes[..., 2:] - boxes[..., :2], axis=-1) import ivy.functional.frontends.torch as torch import ivy f...
null
147,761
import ivy from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.func_wrapper import with_supported_dtypes, with_unsupported_device_and_dtypes import ivy.functional.frontends.torch as torch import ivy from ivy.functional.frontends import set_frontend_to_specific_version if ivy....
null
147,762
import ivy from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.func_wrapper import with_supported_dtypes, with_unsupported_device_and_dtypes import ivy.functional.frontends.torch as torch import ivy from ivy.functional.frontends import set_frontend_to_specific_version if ivy....
null
147,763
import ivy from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back from ivy.func_wrapper import with_supported_dtypes, with_unsupported_device_and_dtypes import ivy.functional.frontends.torch as torch import ivy from ivy.functional.frontends import set_frontend_to_specific_version if ivy....
null
147,764
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 def celu(input, alpha=1.0, inplace=False): return ivy.celu(input, alpha=alpha) def celu_(input, alpha=1.0): return celu(input, alpha=alpha, inpla...
null
147,765
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 def elu(input, alpha=1.0, inplace=False): prod = ivy.multiply( alpha, ivy.subtract(ivy.exp(input), 1), ) return ivy.where(ivy....
null
147,766
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 def gelu(input, *, approximate="none"): if approximate == "none": return ivy.gelu(input, approximate=False) elif approximate == "tanh": ...
null
147,767
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 def sigmoid(input): return ivy.sigmoid(input) def glu(input, dim=-1): a, b = ivy.split(input, num_or_size_splits=2, axis=dim) return ivy.mult...
null
147,768
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 def softmax(input, dim=None, _stacklevel=3, dtype=None): if dtype: input = ivy.astype(ivy.array(input), ivy.as_ivy_dtype(dtype)) return iv...
null
147,769
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 def hardshrink(input, lambd=0.5): mask = ivy.logical_or(ivy.greater(input, lambd), ivy.less(input, -lambd)) return ivy.where(mask, input, 0.0)
null
147,770
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 def hardsigmoid(input, inplace=False): return ivy.divide(ivy.minimum(ivy.maximum(ivy.add(input, 3), 0), 6), 6)
null
147,771
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 def relu6(input, inplace=False): def hardswish(input, inplace=False): relu6_val = ivy.relu6(ivy.add(input, 3)) return ivy.multiply(input, ivy.div...
null
147,772
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 def hardtanh(input, min_val=-1.0, max_val=1.0, inplace=False): def hardtanh_(input, min_val=-1.0, max_val=1.0): return hardtanh(input, min_val=min_va...
null
147,773
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 def leaky_relu(input, negative_slope=0.01, inplace=False): return ivy.leaky_relu(input, alpha=negative_slope) def leaky_relu_(input, negative_slope=0...
null
147,774
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 def local_response_norm(input, size, alpha=0.0001, beta=0.75, k=1.0): non_batched = input.ndim == 3 if non_batched: input = ivy.expand_di...
null
147,775
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 def log_softmax(input, dim=None, _stacklevel=3, dtype=None): if dtype: input = ivy.astype(ivy.array(input), ivy.as_ivy_dtype(dtype)) if d...
null
147,776
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 def logsigmoid(input): return ivy.logsigmoid(input)
null
147,777
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 def softplus(input, beta=1, threshold=20): def tanh(input): def mish(input, inplace=False): return ivy.multiply( input, ivy.tanh(ivy....
null
147,778
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 def normalize(input, p=2.0, dim=1, eps=1e-12, out=None): abs_square = ivy.pow(ivy.abs(input), p) sum_ = ivy.sum(abs_square, axis=dim, keepdims=Tr...
null
147,779
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 def prelu(input, weight): return ivy.add(ivy.maximum(0, input), ivy.multiply(weight, ivy.minimum(0, input)))
null
147,780
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 def relu(input, inplace=False): return ivy.relu(input) def relu_(input): return relu(input, inplace=True)
null
147,781
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 def rrelu(input, lower=1.0 / 8, upper=1.0 / 3, training=False, inplace=False): if training: # alpha = ivy.random_uniform(low=lower, high=upper...
null
147,782
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 def scaled_dot_product_attention( query, key, value, attn_mask=None, dropout_p=0.0, is_causal=False, scale=None ): return ivy.scaled_dot_product_...
null
147,783
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 def selu(input, inplace=False): return ivy.selu(input)
null
147,784
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 def sigmoid(input): return ivy.sigmoid(input) def silu(input, inplace=False): return ivy.multiply(input, ivy.sigmoid(input))
null
147,785
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 def softmax(input, dim=None, _stacklevel=3, dtype=None): if dtype: input = ivy.astype(ivy.array(input), ivy.as_ivy_dtype(dtype)) return iv...
null
147,786
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 def softshrink(input, lambd=0.5): low = ivy.where(ivy.less(input, -lambd), ivy.add(input, lambd), 0) up = ivy.where(ivy.greater(input, lambd), iv...
null
147,787
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 def softsign(input): return ivy.divide(input, ivy.add(1, ivy.abs(input)))
null
147,788
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 def tanh(input): return ivy.tanh(input) def tanhshrink(input): return ivy.subtract(input, ivy.tanh(input))
null