text stringlengths 17 362k | id stringlengths 13 115 | metadata dict | __index_level_0__ int64 0 75 |
|---|---|---|---|
# global
import math
import numpy as np
from typing import Optional, Union, Tuple, List, Literal, Sequence, Callable
# local
import ivy
from ivy.functional.ivy.layers import (
_handle_padding,
_get_num_padded_values,
_validate_max_pool_params,
_depth_max_pooling_helper,
)
from ivy.functional.backends.... | ivy/ivy/functional/backends/numpy/experimental/layers.py/0 | {
"file_path": "ivy/ivy/functional/backends/numpy/experimental/layers.py",
"repo_id": "ivy",
"token_count": 19283
} | 22 |
# global
from collections import namedtuple
from typing import Union, Optional, Tuple, Literal, List, NamedTuple, Sequence
import numpy as np
# local
import ivy
from ivy import inf
from ivy.func_wrapper import with_unsupported_dtypes
from ivy.functional.backends.numpy.helpers import _scalar_output_to_0d_array
from ... | ivy/ivy/functional/backends/numpy/linear_algebra.py/0 | {
"file_path": "ivy/ivy/functional/backends/numpy/linear_algebra.py",
"repo_id": "ivy",
"token_count": 6208
} | 23 |
# global
import math
from typing import Optional, Union
import paddle
import ivy
import ivy.functional.backends.paddle as paddle_backend
from ivy import promote_types_of_inputs
from ivy.func_wrapper import (
with_supported_device_and_dtypes,
with_supported_dtypes,
with_unsupported_device_and_dtypes,
w... | ivy/ivy/functional/backends/paddle/elementwise.py/0 | {
"file_path": "ivy/ivy/functional/backends/paddle/elementwise.py",
"repo_id": "ivy",
"token_count": 17923
} | 24 |
# global
from typing import Optional, Union, Sequence
import paddle
from ivy import with_unsupported_device_and_dtypes
from ivy.functional.backends.paddle import backend_version
from ivy.utils.exceptions import IvyNotImplementedException
from ivy.functional.ivy.random import _check_bounds_and_get_shape
# local
import ... | ivy/ivy/functional/backends/paddle/experimental/random.py/0 | {
"file_path": "ivy/ivy/functional/backends/paddle/experimental/random.py",
"repo_id": "ivy",
"token_count": 1787
} | 25 |
# global
import paddle
from typing import Optional, Union
# local
import ivy
from ivy.func_wrapper import with_unsupported_device_and_dtypes, with_supported_dtypes
from . import backend_version
@with_supported_dtypes(
{"2.6.0 and below": ("float32", "float64", "int32", "int64")}, backend_version
)
def argsort(
... | ivy/ivy/functional/backends/paddle/sorting.py/0 | {
"file_path": "ivy/ivy/functional/backends/paddle/sorting.py",
"repo_id": "ivy",
"token_count": 986
} | 26 |
import operator
from typing import Union, Optional, Tuple, List, Sequence
from numbers import Number
import tensorflow as tf
from tensorflow.python.ops.numpy_ops import np_math_ops
# local
import ivy
from ivy import promote_types_of_inputs
from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
fro... | ivy/ivy/functional/backends/tensorflow/experimental/elementwise.py/0 | {
"file_path": "ivy/ivy/functional/backends/tensorflow/experimental/elementwise.py",
"repo_id": "ivy",
"token_count": 8707
} | 27 |
"""Tensorflow gradient functions.
Collection of TensorFlow gradient functions, wrapped to fit Ivy syntax
and signature.
"""
# global
import tensorflow as tf
from typing import Sequence, Union, Optional, Callable
# local
import ivy
from ivy.func_wrapper import outputs_to_ivy_arrays, inputs_to_native_arrays
from ivy.f... | ivy/ivy/functional/backends/tensorflow/gradients.py/0 | {
"file_path": "ivy/ivy/functional/backends/tensorflow/gradients.py",
"repo_id": "ivy",
"token_count": 3786
} | 28 |
# global
import sys
import torch as torch
# local
import ivy
from ivy.func_wrapper import _dtype_from_version
backend_version = {"version": torch.__version__.split("+")[0]}
# Registering ivy.Array as trackable submodule
if hasattr(torch, "_dynamo"):
torch._dynamo.config.traceable_tensor_subclasses = (ivy.Array,)... | ivy/ivy/functional/backends/torch/__init__.py/0 | {
"file_path": "ivy/ivy/functional/backends/torch/__init__.py",
"repo_id": "ivy",
"token_count": 2966
} | 29 |
# global
from typing import Optional, Union, Tuple, List, Literal, Sequence, Callable
import torch
import math
# local
import ivy
from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
from . import backend_version
from ivy.functional.ivy.layers import (
_handle_padding,
_get_num_padded_va... | ivy/ivy/functional/backends/torch/experimental/layers.py/0 | {
"file_path": "ivy/ivy/functional/backends/torch/experimental/layers.py",
"repo_id": "ivy",
"token_count": 21097
} | 30 |
# global
import math
from numbers import Number
from typing import Iterable, List, Optional, Sequence, Tuple, Union
import torch
# local
import ivy
from ivy.func_wrapper import with_unsupported_dtypes
# noinspection PyProtectedMember
from ivy.functional.ivy.manipulation import _calculate_out_shape
from . import bac... | ivy/ivy/functional/backends/torch/manipulation.py/0 | {
"file_path": "ivy/ivy/functional/backends/torch/manipulation.py",
"repo_id": "ivy",
"token_count": 4849
} | 31 |
from . import numpy
from . import array
from . import tree_util
| ivy/ivy/functional/frontends/jax/_src/__init__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/jax/_src/__init__.py",
"repo_id": "ivy",
"token_count": 18
} | 32 |
from . import non_linear_activations
from .non_linear_activations import *
| ivy/ivy/functional/frontends/jax/nn/__init__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/jax/nn/__init__.py",
"repo_id": "ivy",
"token_count": 21
} | 33 |
from . import probability
from . import transformer
| ivy/ivy/functional/frontends/mindspore/nn/__init__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/mindspore/nn/__init__.py",
"repo_id": "ivy",
"token_count": 10
} | 34 |
import ivy
from ivy.functional.frontends.mxnet.func_wrapper import to_ivy_arrays_and_back
@to_ivy_arrays_and_back
def diagonal(a, offset=0, axis1=0, axis2=1):
return ivy.diagonal(a, offset=offset, axis1=axis1, axis2=axis2)
| ivy/ivy/functional/frontends/mxnet/numpy/symbol.py/0 | {
"file_path": "ivy/ivy/functional/frontends/mxnet/numpy/symbol.py",
"repo_id": "ivy",
"token_count": 95
} | 35 |
import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
import ivy.functional.frontends.numpy as np_frontend
all_complex_dtypes = ["complex64", "complex128"]
all_float_dtypes = [
"float16",
"float32",
"float64",
]
# dtypes as string
all_int_dtypes = ["int8", "int16", "int3... | ivy/ivy/functional/frontends/numpy/data_type_routines/general.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/data_type_routines/general.py",
"repo_id": "ivy",
"token_count": 2120
} | 36 |
# local
import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
)
from ivy.func_wrapper import with_unsupported_dtypes
# det
@to_ivy_arrays_and_back
@from_zero_dim_arrays_to_scalar
def det(a):
return ivy.det(a)
# matrix_rank
@to_ivy_a... | ivy/ivy/functional/frontends/numpy/linalg/norms_and_other_numbers.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/linalg/norms_and_other_numbers.py",
"repo_id": "ivy",
"token_count": 849
} | 37 |
# local
from collections import namedtuple
import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
@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.... | ivy/ivy/functional/frontends/numpy/manipulation_routines/adding_and_removing_elements.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/manipulation_routines/adding_and_removing_elements.py",
"repo_id": "ivy",
"token_count": 684
} | 38 |
# global
import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_out,
handle_numpy_dtype,
handle_numpy_casting,
from_zero_dim_arrays_to_scalar,
)
# --- Helpers --- #
# --------------- #
@handle_numpy_out
@handle_numpy_dtype
@to_ivy_arrays_and_bac... | ivy/ivy/functional/frontends/numpy/mathematical_functions/handling_complex_numbers.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/mathematical_functions/handling_complex_numbers.py",
"repo_id": "ivy",
"token_count": 483
} | 39 |
from . import Generator
from .Generator import *
from . import RandomState
from .RandomState import *
from . import functions
from .functions import *
| ivy/ivy/functional/frontends/numpy/random/__init__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/random/__init__.py",
"repo_id": "ivy",
"token_count": 37
} | 40 |
import ivy
from ivy.functional.frontends.onnx.func_wrapper import to_ivy_arrays_and_back
@to_ivy_arrays_and_back
def Abs(input):
return ivy.abs(input)
@to_ivy_arrays_and_back
def Acos(input):
return ivy.acos(input)
@to_ivy_arrays_and_back
def Acosh(input):
return ivy.acosh(input)
@to_ivy_arrays_and... | ivy/ivy/functional/frontends/onnx/elementwise.py/0 | {
"file_path": "ivy/ivy/functional/frontends/onnx/elementwise.py",
"repo_id": "ivy",
"token_count": 207
} | 41 |
from . import activation
from .activation import *
from . import common
from .common import *
from . import conv
from .conv import *
from . import distance
from .distance import *
from . import extension
from .extension import *
from . import input
from .input import *
from . import loss
from .loss import *
from . impo... | ivy/ivy/functional/frontends/paddle/nn/functional/__init__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/paddle/nn/functional/__init__.py",
"repo_id": "ivy",
"token_count": 113
} | 42 |
# local
from ..creation import * # noqa: F401
| ivy/ivy/functional/frontends/paddle/tensor/creation.py/0 | {
"file_path": "ivy/ivy/functional/frontends/paddle/tensor/creation.py",
"repo_id": "ivy",
"token_count": 16
} | 43 |
import ivy
from .generic import NDFrame
class Series(NDFrame):
def __init__(
self,
data,
index=None,
dtype=None,
name=None,
copy=False,
fastpath=False,
columns=None,
*args,
**kwargs,
):
super().__init__(
data,
... | ivy/ivy/functional/frontends/pandas/series.py/0 | {
"file_path": "ivy/ivy/functional/frontends/pandas/series.py",
"repo_id": "ivy",
"token_count": 1272
} | 44 |
from .linalg import *
from . import interpolative
| ivy/ivy/functional/frontends/scipy/linalg/__init__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/scipy/linalg/__init__.py",
"repo_id": "ivy",
"token_count": 14
} | 45 |
from .spatial import *
from . import distance
from . import transform
| ivy/ivy/functional/frontends/scipy/spatial/__init__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/scipy/spatial/__init__.py",
"repo_id": "ivy",
"token_count": 17
} | 46 |
import ivy
import numbers
from ivy.functional.frontends.numpy.func_wrapper import outputs_to_frontend_arrays
@outputs_to_frontend_arrays
def make_circles(
n_samples=100, *, shuffle=True, noise=None, random_state=None, factor=0.8
):
# numbers.Integral also includes bool
if isinstance(n_samples, numbers.Int... | ivy/ivy/functional/frontends/sklearn/datasets/_samples_generator.py/0 | {
"file_path": "ivy/ivy/functional/frontends/sklearn/datasets/_samples_generator.py",
"repo_id": "ivy",
"token_count": 1205
} | 47 |
import ivy.functional.frontends.tensorflow as tf_frontend
def add(x, y, name=None):
return tf_frontend.math.add(x, y, name=name)
| ivy/ivy/functional/frontends/tensorflow/__operators__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/tensorflow/__operators__.py",
"repo_id": "ivy",
"token_count": 53
} | 48 |
# local
import ivy
from ivy.functional.frontends.tensorflow import check_tensorflow_casting
from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
from ivy.functional.frontends.tensorflow.func_wrapper import (
to_ivy_arrays_and_back,
handle_tf_dtype,
)
import ivy.functional.frontends.tenso... | ivy/ivy/functional/frontends/tensorflow/linalg.py/0 | {
"file_path": "ivy/ivy/functional/frontends/tensorflow/linalg.py",
"repo_id": "ivy",
"token_count": 6895
} | 49 |
# global
import sys
from numbers import Number
from typing import Union, Tuple, Iterable
# local
import ivy
from ivy.utils.exceptions import handle_exceptions
from ivy.functional.frontends import set_frontend_to_specific_version
# Constructing dtypes are required as ivy.<dtype>
# will change dynamically on the backe... | ivy/ivy/functional/frontends/torch/__init__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/torch/__init__.py",
"repo_id": "ivy",
"token_count": 3918
} | 50 |
import ivy
from ivy.func_wrapper import with_supported_device_and_dtypes, with_supported_dtypes
from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back
# --- Helpers --- #
# --------------- #
def _extract_states(states, batch_sizes):
h = []
for i in range(states.shape[1]):
h.a... | ivy/ivy/functional/frontends/torch/nn/functional/layer_functions.py/0 | {
"file_path": "ivy/ivy/functional/frontends/torch/nn/functional/layer_functions.py",
"repo_id": "ivy",
"token_count": 1714
} | 51 |
import ivy
from ivy.func_wrapper import with_supported_dtypes, with_unsupported_dtypes
from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back
@to_ivy_arrays_and_back
def bartlett_window(
window_length,
periodic=True,
*,
dtype=None,
layout=None,
device=None,
requires... | ivy/ivy/functional/frontends/torch/spectral_ops.py/0 | {
"file_path": "ivy/ivy/functional/frontends/torch/spectral_ops.py",
"repo_id": "ivy",
"token_count": 898
} | 52 |
from .core import Booster
def train(
params,
dtrain,
dlabel,
num_boost_round=10,
*,
evals=None,
obj=None,
feval=None,
maximize=None,
early_stopping_rounds=None,
evals_result=None,
verbose_eval=True,
xgb_model=None,
callbacks=None,
custom_metric=None,
):
... | ivy/ivy/functional/frontends/xgboost/training.py/0 | {
"file_path": "ivy/ivy/functional/frontends/xgboost/training.py",
"repo_id": "ivy",
"token_count": 1096
} | 53 |
# global
import functools
from typing import Callable, Union, Sequence
# local
import ivy
from ivy import (
inputs_to_ivy_arrays,
handle_nestable,
handle_array_like_without_promotion,
handle_array_function,
)
from ivy.utils.exceptions import handle_exceptions
def _correct_ivy_callable(func):
# ge... | ivy/ivy/functional/ivy/experimental/general.py/0 | {
"file_path": "ivy/ivy/functional/ivy/experimental/general.py",
"repo_id": "ivy",
"token_count": 1126
} | 54 |
"""Collection of general Ivy functions."""
# global
import gc
import inspect
import itertools
import math
from functools import wraps
from numbers import Number
from typing import (
Callable,
Any,
Union,
List,
Tuple,
Dict,
Iterable,
Optional,
Sequence,
Literal,
)
import einops
i... | ivy/ivy/functional/ivy/general.py/0 | {
"file_path": "ivy/ivy/functional/ivy/general.py",
"repo_id": "ivy",
"token_count": 56877
} | 55 |
"""Collection of Ivy neural network activations as stateful classes."""
# local
import ivy
from ivy.stateful.module import Module
from typing import Literal, Optional
class GELU(Module):
def __init__(
self,
*,
approximate: bool = False,
complex_mode: Literal["split", "magnitude", ... | ivy/ivy/stateful/activations.py/0 | {
"file_path": "ivy/ivy/stateful/activations.py",
"repo_id": "ivy",
"token_count": 6881
} | 56 |
import os
import re
from types import ModuleType, FunctionType
import logging
import importlib
import ivy
from ivy.func_wrapper import _wrap_function
from ivy.utils.exceptions import IvyException
_backends_subpackage_path = "ivy.functional.backends"
_sub_backend_dict = {}
_backend_to_sub_backends_dict = {}
# versi... | ivy/ivy/utils/backend/sub_backend_handler.py/0 | {
"file_path": "ivy/ivy/utils/backend/sub_backend_handler.py",
"repo_id": "ivy",
"token_count": 4711
} | 57 |
# global
import sys
import importlib
from ivy_tests.test_ivy.helpers.hypothesis_helpers.array_helpers import (
array_helpers_dtype_info_helper,
)
from ivy_tests.test_ivy.helpers.hypothesis_helpers.dtype_helpers import (
_get_type_dict_helper,
cast_filter_helper,
)
# local
from .testing_helpers import (
... | ivy/ivy_tests/test_ivy/helpers/multiprocessing.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/helpers/multiprocessing.py",
"repo_id": "ivy",
"token_count": 7337
} | 58 |
from .base import FrontendConfigWithBackend
def get_config():
return TorchFrontendConfig()
class TorchFrontendConfig(FrontendConfigWithBackend):
backend_str = "torch"
| ivy/ivy_tests/test_ivy/test_frontends/config/torch.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/config/torch.py",
"repo_id": "ivy",
"token_count": 55
} | 59 |
import pytest
@pytest.fixture(scope="session")
def frontend():
return "mindspore"
| ivy/ivy_tests/test_ivy/test_frontends/test_mindspore/conftest.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_mindspore/conftest.py",
"repo_id": "ivy",
"token_count": 32
} | 60 |
# global
from numpy import mgrid as np_mgrid, ogrid as np_ogrid
from hypothesis import strategies as st
import ivy
# local
from ivy.functional.frontends.numpy import mgrid, ogrid
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_frontend_test, handle_frontend_method
# --- He... | ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_creation_routines/test_numerical_ranges.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_creation_routines/test_numerical_ranges.py",
"repo_id": "ivy",
"token_count": 4015
} | 61 |
# global
from hypothesis import assume, strategies as st
import numpy as np
# local
import ivy_tests.test_ivy.helpers as helpers
import ivy_tests.test_ivy.test_frontends.test_numpy.helpers as np_frontend_helpers
from ivy_tests.test_ivy.helpers import handle_frontend_test
from ivy_tests.test_ivy.test_functional.test_ex... | ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_mathematical_functions/test_arithmetic_operations.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_mathematical_functions/test_arithmetic_operations.py",
"repo_id": "ivy",
"token_count": 11196
} | 62 |
import pytest
@pytest.fixture(scope="session")
def frontend():
return "onnx"
| ivy/ivy_tests/test_ivy/test_frontends/test_onnx/conftest.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_onnx/conftest.py",
"repo_id": "ivy",
"token_count": 32
} | 63 |
# global
from hypothesis import strategies as st
# local
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_frontend_test
@handle_frontend_test(
fn_tree="tensorflow.nest.flatten",
dtype_and_x=helpers.dtype_and_values(
min_num_dims=2,
max_num_dims=5,
... | ivy/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_nest.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_nest.py",
"repo_id": "ivy",
"token_count": 473
} | 64 |
# global
from hypothesis import settings, strategies as st
# local
import ivy
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers.testing_helpers import handle_frontend_test
import ivy.functional.frontends.torch as torch_frontend
# can_cast
@handle_frontend_test(
fn_tree="torch.can_cast"... | ivy/ivy_tests/test_ivy/test_frontends/test_torch/test_dtype.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_torch/test_dtype.py",
"repo_id": "ivy",
"token_count": 964
} | 65 |
# global
from hypothesis import strategies as st
# local
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_frontend_test
import math
def calculate_same_padding(kernel_size, stride, shape):
padding = tuple(
max(
0,
math.ceil(((shape[i] - 1) ... | ivy/ivy_tests/test_ivy/test_frontends/test_torch/test_nn/test_functional/test_pooling_functions.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_torch/test_nn/test_functional/test_pooling_functions.py",
"repo_id": "ivy",
"token_count": 7049
} | 66 |
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_frontend_method
CLASS_TREE = "ivy.functional.frontends.xgboost.core.DMatrix"
@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="xgboost.DMatrix",
method_name="num_col",
init_array=helpers.dtype_and_valu... | ivy/ivy_tests/test_ivy/test_frontends/test_xgboost/test_core.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_xgboost/test_core.py",
"repo_id": "ivy",
"token_count": 1026
} | 67 |
"""Collection of tests for sorting functions."""
# global
from hypothesis import strategies as st
import numpy as np
# local
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_test
# --- Helpers --- #
# --------------- #
@st.composite
def _searchsorted_case1(draw):
# 1-... | ivy/ivy_tests/test_ivy/test_functional/test_core/test_sorting.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_functional/test_core/test_sorting.py",
"repo_id": "ivy",
"token_count": 2444
} | 68 |
# global
from hypothesis import strategies as st
# local
import numpy as np
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_test
# --- Helpers --- #
# --------------- #
# unravel_index
@st.composite
def max_value_as_shape_prod(draw):
shape = draw(
helpers.get_... | ivy/ivy_tests/test_ivy/test_functional/test_experimental/test_core/test_searching.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_functional/test_experimental/test_core/test_searching.py",
"repo_id": "ivy",
"token_count": 649
} | 69 |
# global
import pytest
from typing import List, Tuple, Dict, Optional, Union
# local
import ivy
# --- Helpers --- #
# --------------- #
def _fn0(xs: Optional[List[ivy.Array]] = None):
return xs
def _fn1(
a: Union[ivy.Array, ivy.NativeArray],
b: str = "hello",
c: Optional[int] = None,
d: ivy.N... | ivy/ivy_tests/test_ivy/test_misc/test_inspection.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_misc/test_inspection.py",
"repo_id": "ivy",
"token_count": 457
} | 70 |
import importlib
import os
import sys
import glob
def get_all_functions_from_directory(root_dir, startswith="test"):
if not os.path.exists(root_dir):
print("Invalid directory")
sys.exit(1)
functions_names = []
for filename in glob.iglob(f"{root_dir}/**/*.py", recursive=True):
if le... | ivy/scripts/duplicate.py/0 | {
"file_path": "ivy/scripts/duplicate.py",
"repo_id": "ivy",
"token_count": 611
} | 71 |
import os
import random
import ast
BACKENDS = ["jax", "numpy", "tensorflow", "torch", "paddle"]
def is_test_function(node):
if isinstance(node, ast.FunctionDef):
return node.name.startswith("test_")
return False
def extract_tests_from_file(filename):
with open(filename, "r") as file:
tr... | ivy/scripts/setup_tests/get_all_tests.py/0 | {
"file_path": "ivy/scripts/setup_tests/get_all_tests.py",
"repo_id": "ivy",
"token_count": 604
} | 72 |
FROM arm64v8/debian:buster
# ensure local python is preferred over distribution python
ENV PATH /usr/local/bin:$PATH
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
# runtime dependencies
RUN set -eux; \
a... | ivy/docker/DockerfileAppleSilicon/0 | {
"file_path": "ivy/docker/DockerfileAppleSilicon",
"repo_id": "ivy",
"token_count": 3458
} | 0 |
{{ name | escape | underline }}
.. autofunction:: ivy.{{ name }}
.. autoskippablemethod:: ivy.Array.{{ name }}
.. autoskippablemethod:: ivy.Container.{{ name }}
| ivy/docs/_templates/functional_module.rst/0 | {
"file_path": "ivy/docs/_templates/functional_module.rst",
"repo_id": "ivy",
"token_count": 56
} | 1 |
Contributor Program
=================
The goal of the Contributor program is to facilitate contributors in the community that would like to work more closely
with our team.
Embark on a rewarding journey with Unify by `signing up <https://forms.gle/Fs6WK3GtsmizZn9SA>`_ as a Contributor.
Let's innovate together!
We've ... | ivy/docs/overview/contributing/volunteer_program.rst/0 | {
"file_path": "ivy/docs/overview/contributing/volunteer_program.rst",
"repo_id": "ivy",
"token_count": 542
} | 2 |
Function Types
==============
.. _`_wrap_function`: https://github.com/unifyai/ivy/blob/1eb841cdf595e2bb269fce084bd50fb79ce01a69/ivy/func_wrapper.py#L412
.. _`backend setting`: https://github.com/unifyai/ivy/blob/1eb841cdf595e2bb269fce084bd50fb79ce01a69/ivy/backend_handler.py#L204
.. _`handle_nestable`: https://github... | ivy/docs/overview/deep_dive/function_types.rst/0 | {
"file_path": "ivy/docs/overview/deep_dive/function_types.rst",
"repo_id": "ivy",
"token_count": 6210
} | 3 |
Ivy Stateful API
================
Here we explain how Ivy’s stateful API builds on the functional API and the :class:`ivy.Container` class to provide other convenient classes in the form of optimizers, network layers, and custom trainable modules, which help get your ML projects up and running very quickly!
So, witho... | ivy/docs/overview/design/ivy_as_a_framework/ivy_stateful_api.rst/0 | {
"file_path": "ivy/docs/overview/design/ivy_as_a_framework/ivy_stateful_api.rst",
"repo_id": "ivy",
"token_count": 7835
} | 4 |
.. _`RWorks Compiler Infrastructure`:
Compiler Infrastructure
=======================
.. _`LLVM`: https://llvm.org/
.. _`Multi Level Intermediate Representation (MLIR)`: https://mlir.llvm.org/
.. _`MLIR`: https://mlir.llvm.org/
.. _`Onnx-mlir`: https://github.com/onnx/onnx-mlir
.. _`ONNX`: https://onnx.ai/
.. _`OneAP... | ivy/docs/overview/related_work/compiler_infrastructure.rst/0 | {
"file_path": "ivy/docs/overview/related_work/compiler_infrastructure.rst",
"repo_id": "ivy",
"token_count": 1067
} | 5 |
# global
import abc
class _ArrayWithData_typeExperimental(abc.ABC):
pass
| ivy/ivy/data_classes/array/experimental/data_type.py/0 | {
"file_path": "ivy/ivy/data_classes/array/experimental/data_type.py",
"repo_id": "ivy",
"token_count": 28
} | 6 |
# global
from typing import Optional
import abc
# local
import ivy
class _ArrayWithUtilityExperimental(abc.ABC):
def optional_get_element(
self: Optional[ivy.Array] = None,
/,
*,
out: Optional[ivy.Array] = None,
) -> ivy.Array:
"""If the input is a tensor or sequence t... | ivy/ivy/data_classes/array/experimental/utility.py/0 | {
"file_path": "ivy/ivy/data_classes/array/experimental/utility.py",
"repo_id": "ivy",
"token_count": 369
} | 7 |
"""Base Container Object."""
# global
import colorama
try:
# noinspection PyPackageRequirements
import h5py
except ModuleNotFoundError:
h5py = None
# local
from .wrapping import add_ivy_container_instance_methods # noqa
from .container import ContainerBase, Container # noqa
colorama.init(strip=False)
| ivy/ivy/data_classes/container/__init__.py/0 | {
"file_path": "ivy/ivy/data_classes/container/__init__.py",
"repo_id": "ivy",
"token_count": 103
} | 8 |
# global
from typing import Optional, Union, List, Dict, Callable, Sequence
# local
from ivy.data_classes.container.base import ContainerBase
import ivy
class _ContainerWithGeneralExperimental(ContainerBase):
@staticmethod
def _static_reduce(
operand: Union[ivy.Container, ivy.Array, ivy.NativeArray],... | ivy/ivy/data_classes/container/experimental/general.py/0 | {
"file_path": "ivy/ivy/data_classes/container/experimental/general.py",
"repo_id": "ivy",
"token_count": 2494
} | 9 |
# local
from ivy.data_classes.container.base import ContainerBase
# ToDo: implement all methods here as public instance methods
# noinspection PyMissingConstructor
class _ContainerWithImage(ContainerBase):
pass
| ivy/ivy/data_classes/container/image.py/0 | {
"file_path": "ivy/ivy/data_classes/container/image.py",
"repo_id": "ivy",
"token_count": 57
} | 10 |
# local
from .base import FactorizedTensor
import ivy
# global
from copy import deepcopy
class Parafac2Tensor(FactorizedTensor):
def __init__(self, parafac2_tensor):
super().__init__()
shape, rank = ivy.Parafac2Tensor.validate_parafac2_tensor(parafac2_tensor)
weights, factors, projection... | ivy/ivy/data_classes/factorized_tensor/parafac2_tensor.py/0 | {
"file_path": "ivy/ivy/data_classes/factorized_tensor/parafac2_tensor.py",
"repo_id": "ivy",
"token_count": 10249
} | 11 |
mod literal;
mod pjrt_buffer;
mod pjrt_client;
mod pjrt_device;
mod pjrt_loaded_executable;
mod shape;
mod xla_builder;
mod xla_op;
use crate::c_lib;
use crate::error::{Error, Result};
use num_derive::FromPrimitive;
use num_traits::FromPrimitive;
pub use literal::Literal;
pub use pjrt_buffer::PjRtBuffer;
pub use pjrt... | ivy/ivy/engines/XLA/rust_api/src/wrappers/mod.rs/0 | {
"file_path": "ivy/ivy/engines/XLA/rust_api/src/wrappers/mod.rs",
"repo_id": "ivy",
"token_count": 6864
} | 12 |
"""Collection of Jax activation functions, wrapped to fit Ivy syntax and
signature."""
# global
import jax
import jax.numpy as jnp
from typing import Optional, Union, Literal
# local
from ivy.functional.backends.jax import JaxArray
def gelu(
x: JaxArray,
/,
*,
approximate: bool = False,
comple... | ivy/ivy/functional/backends/jax/activations.py/0 | {
"file_path": "ivy/ivy/functional/backends/jax/activations.py",
"repo_id": "ivy",
"token_count": 1243
} | 13 |
import math
from typing import Optional, Tuple, Sequence, Union
import jax.numpy as jnp
import jax.scipy.linalg as jla
from collections import namedtuple
from ivy.func_wrapper import with_supported_dtypes
from ivy.functional.backends.jax import JaxArray
import ivy
from ivy.functional.ivy.experimental.linear_algebra i... | ivy/ivy/functional/backends/jax/experimental/linear_algebra.py/0 | {
"file_path": "ivy/ivy/functional/backends/jax/experimental/linear_algebra.py",
"repo_id": "ivy",
"token_count": 2247
} | 14 |
from typing import Optional, Union
import mxnet as mx
from ivy.utils.exceptions import IvyNotImplementedException
def logit(
x: Union[(None, mx.ndarray.NDArray)],
/,
*,
eps: Optional[float] = None,
out: Optional[None] = None,
) -> None:
raise IvyNotImplementedException()
def thresholded_rel... | ivy/ivy/functional/backends/mxnet/experimental/activations.py/0 | {
"file_path": "ivy/ivy/functional/backends/mxnet/experimental/activations.py",
"repo_id": "ivy",
"token_count": 401
} | 15 |
from typing import Union, Optional, Tuple, Sequence
import mxnet as mx
from ivy.utils.exceptions import IvyNotImplementedException
def histogram(
a: None,
/,
*,
bins: Optional[Union[(int, None, str)]] = None,
axis: Optional[None] = None,
extend_lower_interval: Optional[bool] = False,
exte... | ivy/ivy/functional/backends/mxnet/experimental/statistical.py/0 | {
"file_path": "ivy/ivy/functional/backends/mxnet/experimental/statistical.py",
"repo_id": "ivy",
"token_count": 1144
} | 16 |
"""Collection of Numpy activation functions, wrapped to fit Ivy syntax and
signature."""
# global
from typing import Optional, Union, Literal
import numpy as np
# local
import ivy
from ivy.functional.backends.numpy.helpers import _scalar_output_to_0d_array
from ivy.func_wrapper import with_supported_dtypes
from . imp... | ivy/ivy/functional/backends/numpy/activations.py/0 | {
"file_path": "ivy/ivy/functional/backends/numpy/activations.py",
"repo_id": "ivy",
"token_count": 1985
} | 17 |
import math
from typing import Optional, Tuple, Sequence, Union, Any
import numpy as np
import ivy
from ivy.func_wrapper import with_supported_dtypes, with_unsupported_dtypes
from ivy.utils.exceptions import IvyNotImplementedException
from .. import backend_version
from ivy.functional.ivy.experimental.linear_algebra ... | ivy/ivy/functional/backends/numpy/experimental/linear_algebra.py/0 | {
"file_path": "ivy/ivy/functional/backends/numpy/experimental/linear_algebra.py",
"repo_id": "ivy",
"token_count": 2662
} | 18 |
# global
import math
from numbers import Number
from typing import List, Optional, Sequence, Tuple, Union
import numpy as np
# local
import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from . import backend_version
def _flat_array_to_1_dim_array(x):
return x.reshape((1,)) if x.shape == () else x
... | ivy/ivy/functional/backends/numpy/manipulation.py/0 | {
"file_path": "ivy/ivy/functional/backends/numpy/manipulation.py",
"repo_id": "ivy",
"token_count": 3499
} | 19 |
# global
import paddle as paddle
backend_version = {"version": paddle.version.full_version}
from .activations import *
from .converters import *
from .creation import *
from .data_type import *
from .device import *
from .elementwise import *
from .general import *
from .gradients import *
from .layers import *
from ... | ivy/ivy/functional/backends/paddle/experimental/__init__.py/0 | {
"file_path": "ivy/ivy/functional/backends/paddle/experimental/__init__.py",
"repo_id": "ivy",
"token_count": 169
} | 20 |
# global
torch_scatter = None
from typing import Union, Optional, Sequence
import paddle
import ivy
from ivy.func_wrapper import (
with_supported_dtypes,
with_supported_device_and_dtypes,
)
import ivy.functional.backends.paddle as paddle_backend
from ivy.utils.einsum_parser import legalise_einsum_expr
# loc... | ivy/ivy/functional/backends/paddle/statistical.py/0 | {
"file_path": "ivy/ivy/functional/backends/paddle/statistical.py",
"repo_id": "ivy",
"token_count": 5412
} | 21 |
"""Collection of TensorFlow network layers, wrapped to fit Ivy syntax and
signature."""
# global
from typing import Optional, Tuple, Union, Sequence
import tensorflow as tf
from tensorflow.python.types.core import Tensor
# local
import ivy
from ivy.func_wrapper import with_supported_dtypes, with_unsupported_dtypes
f... | ivy/ivy/functional/backends/tensorflow/layers.py/0 | {
"file_path": "ivy/ivy/functional/backends/tensorflow/layers.py",
"repo_id": "ivy",
"token_count": 14955
} | 22 |
"""PyTorch activation functions.
Collection of PyTorch activation functions, wrapped to fit Ivy syntax
and signature.
"""
from typing import Optional, Union, Literal
# global
import numpy as np
import torch
import torch.nn
# local
import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from . import backend... | ivy/ivy/functional/backends/torch/activations.py/0 | {
"file_path": "ivy/ivy/functional/backends/torch/activations.py",
"repo_id": "ivy",
"token_count": 1905
} | 23 |
# global
import math
from collections import namedtuple
import torch
from typing import Optional, Tuple, Sequence, Union
import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from .. import backend_version
from ivy.functional.ivy.experimental.linear_algebra import _check_valid_dimension_size
@with_unsuppo... | ivy/ivy/functional/backends/torch/experimental/linear_algebra.py/0 | {
"file_path": "ivy/ivy/functional/backends/torch/experimental/linear_algebra.py",
"repo_id": "ivy",
"token_count": 2794
} | 24 |
import ivy.functional.frontends.jax as jax_frontend
# Dummy Array class to help with compilation, don't add methods here
class ArrayImpl(jax_frontend.Array):
pass
| ivy/ivy/functional/frontends/jax/_src/array.py/0 | {
"file_path": "ivy/ivy/functional/frontends/jax/_src/array.py",
"repo_id": "ivy",
"token_count": 53
} | 25 |
import ivy
from ivy.functional.frontends.jax.func_wrapper import to_ivy_arrays_and_back
from ivy.func_wrapper import with_supported_dtypes
# --- Helpers --- #
# --------------- #
def _batch_promotion(*args, default_dtype="float64"):
# Promote all types
promote_types = set()
for arg in args:
if ... | ivy/ivy/functional/frontends/jax/nn/non_linear_activations.py/0 | {
"file_path": "ivy/ivy/functional/frontends/jax/nn/non_linear_activations.py",
"repo_id": "ivy",
"token_count": 4225
} | 26 |
from ._op import *
| ivy/ivy/functional/frontends/mxnet/numpy_extension/__init__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/mxnet/numpy_extension/__init__.py",
"repo_id": "ivy",
"token_count": 6
} | 27 |
# global
# local
import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
from ivy.func_wrapper import with_unsupported_dtypes
from ivy.functional.frontends.numpy import promote_types_of_numpy_inputs
from ivy.functional.frontends.numpy.linalg.norms_and_other_numbers import matrix_rank... | ivy/ivy/functional/frontends/numpy/linalg/solving_equations_and_inverting_matrices.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/linalg/solving_equations_and_inverting_matrices.py",
"repo_id": "ivy",
"token_count": 846
} | 28 |
# local
import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
inputs_to_ivy_arrays,
_assert_no_array,
_assert_array,
)
@inputs_to_ivy_arrays
def copyto(dst, src, /, *, casting="same_kind", where=True):
# Handle casting
# Numpy copyto doesn't cast the inputs
# It just checks cast... | ivy/ivy/functional/frontends/numpy/manipulation_routines/basic_operations.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/manipulation_routines/basic_operations.py",
"repo_id": "ivy",
"token_count": 518
} | 29 |
# global
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,
)
# --- Helpers --- #
# --------------- #
@handle_numpy_dtype
@to_ivy_arrays_and_back
@handle_numpy_ca... | ivy/ivy/functional/frontends/numpy/mathematical_functions/hyperbolic_functions.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/mathematical_functions/hyperbolic_functions.py",
"repo_id": "ivy",
"token_count": 1344
} | 30 |
# local
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
@to_ivy_arrays_and_back
@from_zero_dim_arrays_to_scalar
def beta(a, b, size=None):
return ivy.beta(a, b, shape=size)
@to_ivy_array... | ivy/ivy/functional/frontends/numpy/random/functions.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/random/functions.py",
"repo_id": "ivy",
"token_count": 5296
} | 31 |
import functools
from typing import Callable
import ivy
import ivy.functional.frontends.onnx as onnx_frontend
# --- Helpers --- #
# --------------- #
def _from_ivy_array_to_onnx_frontend_tensor(x, nested=False, include_derived=None):
if nested:
return ivy.nested_map(
_from_ivy_array_to_onnx... | ivy/ivy/functional/frontends/onnx/func_wrapper.py/0 | {
"file_path": "ivy/ivy/functional/frontends/onnx/func_wrapper.py",
"repo_id": "ivy",
"token_count": 1218
} | 32 |
# local
import ivy
from ivy.func_wrapper import with_supported_dtypes
from ivy.functional.frontends.paddle.func_wrapper import to_ivy_arrays_and_back
from ivy.functional.frontends.paddle.tensor.math import tanh as paddle_tanh
tanh = paddle_tanh
@with_supported_dtypes({"2.6.0 and below": ("float32", "float64")}, "pa... | ivy/ivy/functional/frontends/paddle/nn/functional/activation.py/0 | {
"file_path": "ivy/ivy/functional/frontends/paddle/nn/functional/activation.py",
"repo_id": "ivy",
"token_count": 3564
} | 33 |
# local
from ..linalg import * # noqa: F401
| ivy/ivy/functional/frontends/paddle/tensor/linalg.py/0 | {
"file_path": "ivy/ivy/functional/frontends/paddle/tensor/linalg.py",
"repo_id": "ivy",
"token_count": 18
} | 34 |
# global
import sys
import ivy
# local
from ivy.functional.frontends import set_frontend_to_specific_version
from . import cluster
from . import constants
from . import fft
from . import fftpack
from . import integrate
from . import interpolate
from . import linalg
from . import ndimage
from . import odr
from . import... | ivy/ivy/functional/frontends/scipy/__init__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/scipy/__init__.py",
"repo_id": "ivy",
"token_count": 224
} | 35 |
# global
import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
import ivy.functional.frontends.scipy as sc_frontend
# --- Helpers --- #
# --------------- #
def _validate_vector(u, dtype=None):
u = ivy.asarray(u, dtype=dtype)
if u.ndim == 1:
return u
raise Valu... | ivy/ivy/functional/frontends/scipy/spatial/distance.py/0 | {
"file_path": "ivy/ivy/functional/frontends/scipy/spatial/distance.py",
"repo_id": "ivy",
"token_count": 651
} | 36 |
from . import _classification
from ._classification import *
| ivy/ivy/functional/frontends/sklearn/metrics/__init__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/sklearn/metrics/__init__.py",
"repo_id": "ivy",
"token_count": 14
} | 37 |
from . import v1
| ivy/ivy/functional/frontends/tensorflow/compat/__init__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/tensorflow/compat/__init__.py",
"repo_id": "ivy",
"token_count": 6
} | 38 |
# global
import ivy
from ivy import (
with_supported_dtypes,
with_unsupported_dtypes,
with_supported_device_and_dtypes,
)
from ivy.functional.frontends.tensorflow import check_tensorflow_casting
from ivy.functional.frontends.tensorflow.func_wrapper import (
to_ivy_arrays_and_back,
handle_tf_dtype,
... | ivy/ivy/functional/frontends/tensorflow/math.py/0 | {
"file_path": "ivy/ivy/functional/frontends/tensorflow/math.py",
"repo_id": "ivy",
"token_count": 13493
} | 39 |
# global
import ivy
from ivy.func_wrapper import with_unsupported_dtypes
import ivy.functional.frontends.torch as torch_frontend
from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back
@to_ivy_arrays_and_back
def addbmm(input, batch1, batch2, *, beta=1, alpha=1, out=None):
if len(ivy.shape(... | ivy/ivy/functional/frontends/torch/blas_and_lapack_ops.py/0 | {
"file_path": "ivy/ivy/functional/frontends/torch/blas_and_lapack_ops.py",
"repo_id": "ivy",
"token_count": 3522
} | 40 |
# local
import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back
@with_unsupported_dtypes({"2.2 and below": ("float16",)}, "torch")
@to_ivy_arrays_and_back
def linear(input, weight, bias=None):
return ivy.linear(input, weight, b... | ivy/ivy/functional/frontends/torch/nn/functional/linear_functions.py/0 | {
"file_path": "ivy/ivy/functional/frontends/torch/nn/functional/linear_functions.py",
"repo_id": "ivy",
"token_count": 123
} | 41 |
# global
from typing import Iterable
import math
# local
import ivy
import ivy.functional.frontends.torch as torch_frontend
from ivy.functional.frontends.numpy.creation_routines.from_existing_data import (
array as np_frontend_array,
)
from ivy.func_wrapper import with_unsupported_dtypes
from ivy.func_wrapper impo... | ivy/ivy/functional/frontends/torch/tensor.py/0 | {
"file_path": "ivy/ivy/functional/frontends/torch/tensor.py",
"repo_id": "ivy",
"token_count": 38095
} | 42 |
from . import activations
from .activations import *
from . import constants
from .constants import *
from . import creation
from .creation import *
from . import data_type
from .data_type import *
from . import device
from .device import *
from . import elementwise
from .elementwise import *
from . import general
from... | ivy/ivy/functional/ivy/__init__.py/0 | {
"file_path": "ivy/ivy/functional/ivy/__init__.py",
"repo_id": "ivy",
"token_count": 419
} | 43 |
# local
from ivy.utils.backend import current_backend
def bind_custom_gradient_function(func, custom_grad_func):
"""Bind a custom gradient function to a function.
Parameters
----------
func
Function for which we compute the gradients of the output with respect to.
custom_grad_func
... | ivy/ivy/functional/ivy/experimental/gradients.py/0 | {
"file_path": "ivy/ivy/functional/ivy/experimental/gradients.py",
"repo_id": "ivy",
"token_count": 621
} | 44 |
"""Collection of gradient Ivy functions."""
# global
from typing import Sequence, Union, Optional, Tuple, Callable
import numpy as np
import itertools
# local
import ivy
from ivy.utils.backend import current_backend
from ivy.func_wrapper import (
handle_array_function,
inputs_to_ivy_arrays,
to_native_arr... | ivy/ivy/functional/ivy/gradients.py/0 | {
"file_path": "ivy/ivy/functional/ivy/gradients.py",
"repo_id": "ivy",
"token_count": 22129
} | 45 |
"""Converters from Native Modules to Ivy Modules."""
# global
import functools
from typing import Optional, Dict, List
import re # noqa
import inspect
# local
import ivy
from ivy.utils.backend import current_backend
def to_ivy_module(
native_module=None,
native_module_class=None,
args=None,
kwargs... | ivy/ivy/stateful/converters.py/0 | {
"file_path": "ivy/ivy/stateful/converters.py",
"repo_id": "ivy",
"token_count": 9484
} | 46 |
import os
import logging
import json
from packaging import tags
from urllib import request
from tqdm import tqdm
def _get_paths_from_binaries(binaries, root_dir=""):
"""Get all the paths from the binaries.json into a list."""
paths = []
ext = "pyd" if os.name == "nt" else "so"
if isinstance(binaries, ... | ivy/ivy/utils/binaries.py/0 | {
"file_path": "ivy/ivy/utils/binaries.py",
"repo_id": "ivy",
"token_count": 2763
} | 47 |
import os
this_dir = os.path.dirname(os.path.realpath(__file__))
func_folder = os.path.join(this_dir, "array_api_methods_to_test")
# api function filepaths
func_fnames = os.listdir(func_folder)
func_fnames.sort()
func_fpaths = [os.path.join(func_folder, fname) for fname in func_fnames]
# all filepaths
fpaths = func... | ivy/ivy_tests/array_api_testing/write_array_api_tests_k_flag.py/0 | {
"file_path": "ivy/ivy_tests/array_api_testing/write_array_api_tests_k_flag.py",
"repo_id": "ivy",
"token_count": 1166
} | 48 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.