id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
146,889 | import ivy.functional.frontends.numpy as ivy_np
class Generator:
def __init__(self, bit_generator=None):
self.seed = bit_generator
def multinomial(self, n, pvals, size=None):
ivy_np.random.multinomial(n, pvals, size=size)
def default__rng(seed=None):
return Generator(bit_generator=seed) | null |
146,890 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def beta(a, b, size=None):
return ivy.beta(a, b, shape=size) | null |
146,891 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def poisson(lam=1.0, size=None):
def binomial(n, p, size=None):
if p < 0 or p > 1:
raise ValueError("p must be in the interval (0, 1)"... | null |
146,892 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def multinomial(n, pvals, size=None):
assert not ivy.exists(size) or (len(size) > 0 and len(size) < 3)
batch_size = 1
if ivy.exists(siz... | null |
146,893 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def dirichlet(alpha, size=None):
return ivy.dirichlet(alpha, size=size) | null |
146,894 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def exponential(scale=1.0, size=None, dtype="float64"):
if scale > 0:
# Generate samples that are uniformly distributed based on given... | null |
146,895 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def gamma(shape, scale=1.0, size=None):
return ivy.gamma(shape, scale, shape=size, dtype="float64")
def f(dfn, dfd, size=None):
# Generate... | null |
146,896 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def geometric(p, size=None):
if p < 0 or p > 1:
raise ValueError("p must be in the interval [0, 1]")
oneMinusP = ivy.subtract(1, p... | null |
146,897 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def gumbel(loc=0.0, scale=1.0, size=None):
u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype="float64")
x = loc - scale * ivy.lo... | null |
146,898 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def laplace(loc=0.0, scale=1.0, size=None):
u = ivy.random_uniform(low=0.0, high=0.0, shape=size, dtype="float64")
u = loc - scale * ivy.s... | null |
146,899 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def logistic(loc=0.0, scale=1.0, size=None):
u = ivy.random_uniform(low=0.0, high=0.0, shape=size, dtype="float64")
x = loc + scale * ivy.... | null |
146,900 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def lognormal(mean=0.0, sigma=1.0, size=None):
ret = ivy.exp(ivy.random_normal(mean=mean, std=sigma, shape=size, dtype="float64"))
return ... | null |
146,901 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def logseries(p=0, size=None):
if p < 0 or p >= 1:
raise ValueError("p value must be in the open interval (0, 1)")
r = ivy.log(1 -... | null |
146,902 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def gamma(shape, scale=1.0, size=None):
return ivy.gamma(shape, scale, shape=size, dtype="float64")
def poisson(lam=1.0, size=None):
return... | null |
146,903 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def chisquare(df, size=None):
df = ivy.array(df) # scalar ints and floats are also array_like
if ivy.any(df <= 0):
raise ValueErro... | null |
146,904 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def normal(loc=0.0, scale=1.0, size=None):
return ivy.random_normal(mean=loc, std=scale, shape=size, dtype="float64") | null |
146,905 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def pareto(a, size=None):
if a < 0:
return 0
u = ivy.random_uniform(low=0.0, high=0.0, shape=size, dtype="float64")
return ivy... | null |
146,906 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def shuffle(x, axis=0, /):
if isinstance(x, int):
x = ivy.arange(x)
return ivy.shuffle(x, axis)
def permutation(x, /):
if isin... | null |
146,907 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def random_sample(size=None):
return ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype="float64") | null |
146,908 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def rayleigh(scale, size=None):
u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype="float64")
log_u = ivy.log(u)
x = ivy.mult... | null |
146,909 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def standard_cauchy(size=None):
u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype="float64")
return ivy.tan(ivy.pi * (u - 0.5)) | null |
146,910 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def standard_exponential(size=None):
if size is None:
size = 1
U = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype="float6... | null |
146,911 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def gamma(shape, scale=1.0, size=None):
def standard_gamma(shape, size=None):
return ivy.gamma(shape, 1.0, shape=size, dtype="float64") | null |
146,912 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def gamma(shape, scale=1.0, size=None):
return ivy.gamma(shape, scale, shape=size, dtype="float64")
def standard_t(df, size=None):
numerat... | null |
146,913 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def triangular(left, mode, right, size=None):
if left > mode or mode > right or left == right:
raise ivy.utils.exceptions.IvyValueErro... | null |
146,914 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def uniform(low=0.0, high=1.0, size=None):
return ivy.random_uniform(low=low, high=high, shape=size, dtype="float64") | null |
146,915 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def vonmises(mu, kappa, size=None):
t_size = 0
# Output shape. If the given shape is, e.g., (m, n, k),
# then m * n * k samples are dr... | null |
146,916 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def wald(mean, scale, size=None):
if size is None:
size = 1
mu_2l = mean / (2 * scale)
Y = ivy.random_normal(mean=0, std=1, sh... | null |
146,917 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def weibull(a, size=None):
if a < 0:
return 0
u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype="float64")
return iv... | null |
146,918 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy import with_supported_dtypes
def zipf(a, size=None):
if a <= 1:
return 0
u = ivy.random_uniform(low=0.0, high=1.0, shape=size, dtype="float64")
return ivy.... | null |
146,919 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_casting,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
def _logical_and(
x1,
x2,
/,
out=None,
*,
where=True,
casting="same_kind",
order... | null |
146,920 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_casting,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
def _logical_not(
x,
/,
out=None,
*,
where=True,
casting="same_kind",
order="k",
... | null |
146,921 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_casting,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
def _logical_or(
x1,
x2,
/,
out=None,
*,
where=True,
casting="same_kind",
order=... | null |
146,922 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_casting,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
def _logical_xor(
x1,
x2,
/,
out=None,
*,
where=True,
casting="same_kind",
order... | null |
146,923 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
inputs_to_ivy_arrays,
handle_numpy_casting,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
def _equal(
x1,
x2,
/,
out=None,
*,
where=True,
casting="s... | null |
146,924 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
inputs_to_ivy_arrays,
handle_numpy_casting,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
def _greater(
x1,
x2,
/,
out=None,
*,
where=True,
casting=... | null |
146,925 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
inputs_to_ivy_arrays,
handle_numpy_casting,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
def _greater_equal(
x1,
x2,
/,
out=None,
*,
where=True,
ca... | null |
146,926 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
inputs_to_ivy_arrays,
handle_numpy_casting,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
def _less(
x1,
x2,
/,
out=None,
*,
where=True,
casting="sa... | null |
146,927 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
inputs_to_ivy_arrays,
handle_numpy_casting,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
def _less_equal(
x1,
x2,
/,
out=None,
*,
where=True,
casti... | null |
146,928 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
inputs_to_ivy_arrays,
handle_numpy_casting,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
def _not_equal(
x1,
x2,
/,
out=None,
*,
where=True,
castin... | null |
146,929 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
inputs_to_ivy_arrays,
handle_numpy_casting,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
def array_equal(a1, a2, equal_nan=False):
if not equal_nan:
return ivy.arra... | null |
146,930 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
inputs_to_ivy_arrays,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
from ivy.functional.frontends.numpy import promote_types_of_numpy_inputs
from ivy.func_wrapper import with_supported_dtypes
def promote_... | null |
146,931 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
inputs_to_ivy_arrays,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
from ivy.functional.frontends.numpy import promote_types_of_numpy_inputs
from ivy.func_wrapper import with_supported_dtypes
def promote_... | null |
146,932 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
inputs_to_ivy_arrays,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
from ivy.functional.frontends.numpy import promote_types_of_numpy_inputs
from ivy.func_wrapper import with_supported_dtypes
def isin(ele... | null |
146,933 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
inputs_to_ivy_arrays,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
from ivy.functional.frontends.numpy import promote_types_of_numpy_inputs
from ivy.func_wrapper import with_supported_dtypes
def isneginf... | null |
146,934 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
inputs_to_ivy_arrays,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
from ivy.functional.frontends.numpy import promote_types_of_numpy_inputs
from ivy.func_wrapper import with_supported_dtypes
def isposinf... | null |
146,935 | import ivy
import ivy.functional.frontends.numpy as np_frontend
import numpy as np
class MaskedArray(np_frontend.ndarray):
def __init__(
self,
data,
mask=nomask,
dtype=None,
copy=False,
ndmin=0,
fill_value=None,
keep_mask=True,
hard_mask=False,... | null |
146,936 | import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
def mean(a, axis=None, dtype=None, out=None, keepdims=False, *, where=True):
axis ... | null |
146,937 | import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
def cov(
m,
y=None,
/,
*,
rowvar=True,
bias=False,
ddof=N... | null |
146,938 | import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
def mean(a, axis=None, dtype=None, out=None, keepdims=False, *, where=True):
axis ... | null |
146,939 | import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
def nanmedian(
a,
/,
*,
axis=None,
keepdims=False,
out=None,
... | null |
146,940 | import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
def std(
x,
/,
*,
axis=None,
ddof=0.0,
keepdims=False,
out... | null |
146,941 | import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
def var(x, /, *, axis=None, ddof=0.0, keepdims=False, out=None, dtype=None, where=True... | null |
146,942 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_out,
)
def _cpercentile(N, percent, key=lambda x: x):
"""Find the percentile of a list of values.
"""
N.sort()
k = (len(N) - 1) * percent
f = ivy.math.floor(k)
c = ivy.math.ceil(k)... | null |
146,943 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_out,
)
def ptp(a, axis=None, out=None, keepdims=False):
x = ivy.max(a, axis=axis, keepdims=keepdims)
y = ivy.min(a, axis=axis, keepdims=keepdims)
ret = ivy.subtract(x, y)
return ret.astype(... | null |
146,944 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
from ivy.func_wrapper import with_supported_dtypes
def bincount(x, /, weights=None, minlength=0):
return ivy.bincount(x, weights=weights, minlength=minlength) | null |
146,945 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_dtype,
)
def corrcoef(x, y=None, /, *, rowvar=True, bias=None, ddof=None, dtype="float64"):
if (bias is not None) or (ddof is not None):
ivy.warn("bias and ddof are deprecated and have no effec... | null |
146,946 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_dtype,
)
def correlate(a, v, mode=None, *, old_behavior=False):
dtypes = [x.dtype for x in [a, v]]
mode = mode if mode is not None else "valid"
ivy.utils.assertions.check_equal(a.ndim, 1, as_ar... | null |
146,947 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def split(ary, indices_or_sections, axis=0):
def array_split(ary, indices_or_sections, axis=0):
return ivy.split(
ary, num_or_size_splits=indices_or_sections, axis=axis, with_remainder=True
) | null |
146,948 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def dsplit(ary, indices_or_sections):
if isinstance(indices_or_sections, (list, tuple, ivy.Array)):
indices_or_sections = (
ivy.diff(indices_or_sections, prepend=[0], append=[ary.shape[2]])
.as... | null |
146,949 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def hsplit(ary, indices_or_sections):
if isinstance(indices_or_sections, (list, tuple, ivy.Array)):
if ary.ndim == 1:
indices_or_sections = (
ivy.diff(indices_or_sections, prepend=[0], appe... | null |
146,950 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def vsplit(ary, indices_or_sections):
if isinstance(indices_or_sections, (list, tuple, ivy.Array)):
indices_or_sections = (
ivy.diff(indices_or_sections, prepend=[0], append=[ary.shape[0]])
.as... | null |
146,951 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
)
def asanyarray(a, dtype=None, order=None, like=None):
return ivy.asarray(a) | null |
146,952 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
)
def asarray_chkfinite(a, dtype=None, order=None):
a = ivy.asarray(a, dtype=dtype)
if not ivy.all(ivy.isfinite(a)):
raise ValueError("array must not contain infs or NaNs")
return a | null |
146,953 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
)
def asfarray(a, dtype=ivy.float64):
return ivy.asarray(a, dtype=ivy.float64) | null |
146,954 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
)
def broadcast_to(array, shape, subok=False):
return ivy.broadcast_to(array, shape) | null |
146,955 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
)
def moveaxis(a, source, destination):
return ivy.moveaxis(a, source, destination) | null |
146,956 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
)
def reshape(x, /, newshape, order="C"):
return ivy.reshape(x, shape=newshape, order=order)
def ravel(a, order="C"):
return ivy.reshape(a, shape=(-1,), order=order) | null |
146,957 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
)
def require(a, dtype=None, requirements=None, *, like=None):
return ivy.asarray(a, dtype=dtype) | null |
146,958 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
)
def reshape(x, /, newshape, order="C"):
def resize(x, newshape, /, refcheck=True):
if isinstance(newshape, int):
newshape = (newshape,)
x_new = ivy.reshape(x, shape=(-1,), order="C")
total_size = 1
... | null |
146,959 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def rollaxis(a, axis, start=0):
n = len(ivy.shape(a))
if axis < -n or axis >= n:
raise ValueError(f"axis {axis} is out of bounds for array of {n} dimensions")
if axis < 0:
axis += n
if start < 0:
... | null |
146,960 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def swapaxes(a, axis1, axis2):
return ivy.swapaxes(a, axis1, axis2) | null |
146,961 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def transpose(array, /, *, axes=None):
if not axes:
axes = list(range(len(array.shape)))[::-1]
if isinstance(axes, int):
axes = [axes]
if (len(array.shape) == 0 and not axes) or (len(array.shape) == 1 ... | null |
146,962 | from collections import namedtuple
import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def trim_zeros(filt, trim="fb"):
first = 0
trim = trim.upper()
if "F" in trim:
for i in filt:
if i != 0.0:
break
else:
... | null |
146,963 | from collections import namedtuple
import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def append(arr, values, axis=None):
if axis is None:
return ivy.concat((ivy.flatten(arr), ivy.flatten(values)), axis=0)
else:
return ivy.concat((arr, values), axis=axis)
... | null |
146,964 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_casting,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
import ivy.functional.frontends.numpy as np_frontend
def column_stack(tup):
out_dtype = ivy.dtype(tup[0])
... | null |
146,965 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_casting,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
import ivy.functional.frontends.numpy as np_frontend
def concatenate(arrays, /, *, axis=0, out=None, dtype=None,... | null |
146,966 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_casting,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
import ivy.functional.frontends.numpy as np_frontend
def hstack(tup):
out_dtype = ivy.dtype(tup[0])
for ... | null |
146,967 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_casting,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
import ivy.functional.frontends.numpy as np_frontend
def stack(arrays, /, *, axis=0, out=None):
out_dtype = ... | null |
146,968 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_casting,
handle_numpy_dtype,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
import ivy.functional.frontends.numpy as np_frontend
def vstack(tup):
out_dtype = ivy.dtype(tup[0])
for ... | null |
146,969 | import ivy.functional.frontends.numpy as np_frontend
import ivy
def asmatrix(data, dtype=None):
return np_frontend.matrix(ivy.array(data), dtype=dtype, copy=False) | null |
146,970 | import ivy.functional.frontends.numpy as np_frontend
import ivy
def asscalar(a):
return a.item() | null |
146,971 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def atleast_1d(
*arys,
):
return ivy.atleast_1d(*arys) | null |
146,972 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def atleast_2d(*arys):
return ivy.atleast_2d(*arys) | null |
146,973 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def atleast_3d(*arys):
return ivy.atleast_3d(*arys) | null |
146,974 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def broadcast_arrays(*args):
return ivy.broadcast_arrays(*args) | null |
146,975 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def expand_dims(
a,
axis,
):
return ivy.expand_dims(a, axis=axis) | null |
146,976 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def squeeze(
a,
axis=None,
):
return ivy.squeeze(a, axis=axis) | null |
146,977 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def repeat(a, repeats, axis=None):
return ivy.repeat(a, repeats, axis=axis) | null |
146,978 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def tile(A, reps):
return ivy.tile(A, reps) | null |
146,979 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
)
def pad(array, pad_width, mode="constant", **kwargs):
return ivy.pad(array, pad_width, mode=mode, **kwargs) | null |
146,980 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def flip(m, axis=None):
return ivy.flip(m, axis=axis, out=None) | null |
146,981 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def fliplr(m):
return ivy.fliplr(m, out=None) | null |
146,982 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def flipud(m):
return ivy.flipud(m, out=None) | null |
146,983 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def roll(a, shift, axis=None):
return ivy.roll(a, shift, axis=axis) | null |
146,984 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
def rot90(m, k=1, axes=(0, 1)):
return ivy.rot90(m, k=k, axes=axes) | null |
146,985 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
inputs_to_ivy_arrays,
_assert_no_array,
_assert_array,
)
def _assert_array(args, dtype, scalar_check=False, casting="safe"):
if args and dtype:
if not scalar_check:
ivy.utils.assertions.check_all_or_any_fn(
... | null |
146,986 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
inputs_to_ivy_arrays,
_assert_no_array,
_assert_array,
)
def shape(array, /):
return ivy.shape(array) | null |
146,987 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
def fftfreq(n, d=1.0):
if not isinstance(
n, (int, type(ivy.int8), type(ivy.int16), type(ivy.int32), type(ivy.int64))
):
raise Ty... | null |
146,988 | import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
def fft(a, n=None, axis=-1, norm=None):
return ivy.fft(ivy.astype(a, ivy.complex128), axis, norm=norm, n=n)
def fftn(a, s=None, axes=None, norm=None)... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.