text stringlengths 17 362k | id stringlengths 13 115 | metadata dict | __index_level_0__ int64 0 75 |
|---|---|---|---|
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>
| ivy/.idea/codeStyles/codeStyleConfig.xml/0 | {
"file_path": "ivy/.idea/codeStyles/codeStyleConfig.xml",
"repo_id": "ivy",
"token_count": 51
} | 0 |
# How to Contribute
You can pick an open issue to contribute from our [ToDo list issues](https://github.com/unifyai/ivy/issues?q=is%3Aopen+is%3Aissue+label%3AToDo), which is the placeholder of our subtasks.
Please, follow the next process when you work on your subtask:
## Steps
1. **Choosing a Task:**
- Choose ... | ivy/CONTRIBUTING.md/0 | {
"file_path": "ivy/CONTRIBUTING.md",
"repo_id": "ivy",
"token_count": 849
} | 1 |
#!/bin/bash
docker build --progress=plain -t unifyai/multiversion:base -f MultiversionDockerFile ..
| ivy/docker/build_multiversiondockerfile.sh/0 | {
"file_path": "ivy/docker/build_multiversiondockerfile.sh",
"repo_id": "ivy",
"token_count": 39
} | 2 |
.. title:: Home
.. include:: ../README.md
:parser: myst_parser.sphinx_
.. toctree::
:hidden:
:maxdepth: -1
Home <self>
.. toctree::
:hidden:
:maxdepth: -1
:caption: The Basics
overview/get_started.rst
demos/quickstart.ipynb
.. toctree::
:hidden:
:maxdepth: -1
:caption: Demos
demos/le... | ivy/docs/index.rst/0 | {
"file_path": "ivy/docs/index.rst",
"repo_id": "ivy",
"token_count": 514
} | 3 |
Containers
==========
.. _`ivy.Container`: https://github.com/unifyai/ivy/blob/b725ed10bca15f6f10a0e5154af10231ca842da2/ivy/container/container.py#L52
.. _`dict`: https://github.com/unifyai/ivy/blob/b725ed10bca15f6f10a0e5154af10231ca842da2/ivy/container/base.py#L51
.. _`ivy.Container.cont_map`: https://github.com/unif... | ivy/docs/overview/deep_dive/containers.rst/0 | {
"file_path": "ivy/docs/overview/deep_dive/containers.rst",
"repo_id": "ivy",
"token_count": 7349
} | 4 |
Ivy-Lint: Ivy's Custom Code Formatters
======================================
Overview
--------
``ivy-lint`` is a specialized suite of formatters crafted for the Ivy codebase. It addresses unique formatting requirements not catered to by standard Python formatters. While the suite currently highlights the ``FunctionO... | ivy/docs/overview/deep_dive/ivy_lint.rst/0 | {
"file_path": "ivy/docs/overview/deep_dive/ivy_lint.rst",
"repo_id": "ivy",
"token_count": 681
} | 5 |
Motivation
==========
| (a) `ML Explosion <motivation/ml_explosion.rst>`_
| A huge number of ML tools have exploded onto the scene!
|
| (b) `Why Unify? <motivation/why_unify.rst>`_
| Why should we try to unify them?
|
| (c) `Standardization <motivation/standardization.rst>`_
| We’re collaborating with The `Consortium ... | ivy/docs/overview/motivation.rst/0 | {
"file_path": "ivy/docs/overview/motivation.rst",
"repo_id": "ivy",
"token_count": 195
} | 6 |
.. _`RWorks Vendor-Specific APIs`:
Vendor-Specific APIs
====================
.. _`CUDA`: https://developer.nvidia.com/cuda-toolkit
.. _`TensorRT`: https://developer.nvidia.com/tensorrt
.. _`NVIDIA`: https://www.nvidia.com/
.. _`PyTorch`: https://pytorch.org/
.. _`TensorFlow`: https://www.tensorflow.org/
.. _`Compute ... | ivy/docs/overview/related_work/vendor_specific_apis.rst/0 | {
"file_path": "ivy/docs/overview/related_work/vendor_specific_apis.rst",
"repo_id": "ivy",
"token_count": 684
} | 7 |
# flake8: noqa
# global
import copy
import functools
import numpy as np
from operator import mul
from typing import Optional
# local
import ivy
from .conversions import args_to_native, to_ivy
from .activations import _ArrayWithActivations
from .creation import _ArrayWithCreation
from .data_type import _ArrayWithDataTy... | ivy/ivy/data_classes/array/array.py/0 | {
"file_path": "ivy/ivy/data_classes/array/array.py",
"repo_id": "ivy",
"token_count": 17731
} | 8 |
# global
import abc
from typing import Optional, Union, Tuple, List, Literal, Sequence, Callable
# local
import ivy
class _ArrayWithLayersExperimental(abc.ABC):
def max_pool1d(
self: ivy.Array,
kernel: Union[int, Tuple[int, ...]],
strides: Union[int, Tuple[int, ...]],
padding: Uni... | ivy/ivy/data_classes/array/experimental/layers.py/0 | {
"file_path": "ivy/ivy/data_classes/array/experimental/layers.py",
"repo_id": "ivy",
"token_count": 22888
} | 9 |
# global
import abc
from typing import Optional, Union
# local
import ivy
class _ArrayWithLosses(abc.ABC):
def cross_entropy(
self: ivy.Array,
pred: Union[ivy.Array, ivy.NativeArray],
/,
*,
axis: int = -1,
epsilon: float = 1e-7,
reduction: str = "mean",
... | ivy/ivy/data_classes/array/losses.py/0 | {
"file_path": "ivy/ivy/data_classes/array/losses.py",
"repo_id": "ivy",
"token_count": 2787
} | 10 |
# global
from typing import Optional, Union, List, Dict, Tuple, Callable
# local
import ivy
from ivy.data_classes.container.base import ContainerBase
# ToDo: implement all methods here as public instance methods
# noinspection PyMissingConstructor
class _ContainerWithDataTypes(ContainerBase):
@staticmethod
... | ivy/ivy/data_classes/container/data_type.py/0 | {
"file_path": "ivy/ivy/data_classes/container/data_type.py",
"repo_id": "ivy",
"token_count": 22747
} | 11 |
# global
from typing import (
Optional,
Union,
List,
Dict,
Sequence,
Tuple,
Literal,
Any,
Callable,
Iterable,
)
from numbers import Number
# local
import ivy
from ivy.data_classes.container.base import ContainerBase
class _ContainerWithManipulationExperimental(ContainerBase):
... | ivy/ivy/data_classes/container/experimental/manipulation.py/0 | {
"file_path": "ivy/ivy/data_classes/container/experimental/manipulation.py",
"repo_id": "ivy",
"token_count": 76207
} | 12 |
# global
from typing import Optional, Union, List, Dict
# local
import ivy
from ivy.data_classes.container.base import ContainerBase
# noinspection PyMissingConstructor
class _ContainerWithRandom(ContainerBase):
@staticmethod
def _static_random_uniform(
*,
low: Union[float, ivy.Container, ivy... | ivy/ivy/data_classes/container/random.py/0 | {
"file_path": "ivy/ivy/data_classes/container/random.py",
"repo_id": "ivy",
"token_count": 22064
} | 13 |
# global
from typing import Optional, Union
# local
import ivy
from .base import NestedArrayBase
class NestedArrayElementwise(NestedArrayBase):
@staticmethod
def static_add(
x1: Union[NestedArrayBase, ivy.Array, ivy.NestedArray],
x2: Union[NestedArrayBase, ivy.Array, ivy.NestedArray],
... | ivy/ivy/data_classes/nested_array/elementwise.py/0 | {
"file_path": "ivy/ivy/data_classes/nested_array/elementwise.py",
"repo_id": "ivy",
"token_count": 222
} | 14 |
use super::{
handle_status, FromPrimitive, Literal, NativeType, PrimitiveType, Shape, XlaComputation, XlaOp,
};
use crate::{c_lib, Error, Result};
use std::rc::Rc;
use pyo3::prelude::*;
/// A builder is used to keep track of a computation graph while it's being built.
pub(super) struct XlaBuilderInternal(c_lib::xl... | ivy/ivy/engines/XLA/rust_api/src/wrappers/xla_builder.rs/0 | {
"file_path": "ivy/ivy/engines/XLA/rust_api/src/wrappers/xla_builder.rs",
"repo_id": "ivy",
"token_count": 4757
} | 15 |
# global
import jax
backend_version = {"version": jax.__version__}
# local sub-modules
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 .line... | ivy/ivy/functional/backends/jax/experimental/__init__.py/0 | {
"file_path": "ivy/ivy/functional/backends/jax/experimental/__init__.py",
"repo_id": "ivy",
"token_count": 173
} | 16 |
# global
from typing import Callable
import mxnet as mx
# local
import ivy
from ivy.functional.ivy.gradients import (
_flatten_containers,
_rebuild_flattened_containers,
)
from ivy.utils.exceptions import IvyNotImplementedException
def bind_custom_gradient_function(func, custom_grad_fn):
raise IvyNotImpl... | ivy/ivy/functional/backends/mxnet/experimental/gradients.py/0 | {
"file_path": "ivy/ivy/functional/backends/mxnet/experimental/gradients.py",
"repo_id": "ivy",
"token_count": 770
} | 17 |
import mxnet as mx
from numbers import Number
from typing import Union, Tuple, Optional, List, Sequence
import ivy
from ivy.utils.exceptions import IvyNotImplementedException
def concat(
xs: Union[(Tuple[(None, ...)], List[None])],
/,
*,
axis: int = 0,
out: Optional[Union[(None, mx.ndarray.NDArra... | ivy/ivy/functional/backends/mxnet/manipulation.py/0 | {
"file_path": "ivy/ivy/functional/backends/mxnet/manipulation.py",
"repo_id": "ivy",
"token_count": 1876
} | 18 |
# global
import numpy as np
backend_version = {"version": np.__version__}
# local sub-modules
from .activations import *
from .creation import *
from .data_type import *
from .device import *
from .elementwise import *
from .general import *
from .gradients import *
from .layers import *
from .linear_algebra import *... | ivy/ivy/functional/backends/numpy/experimental/__init__.py/0 | {
"file_path": "ivy/ivy/functional/backends/numpy/experimental/__init__.py",
"repo_id": "ivy",
"token_count": 166
} | 19 |
# global
import numpy as np
from typing import Union, Optional, Sequence
# local
import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from ivy.functional.backends.numpy.helpers import _scalar_output_to_0d_array
from . import backend_version
from ivy.utils.einsum_parser import legalise_einsum_expr
# Array ... | ivy/ivy/functional/backends/numpy/statistical.py/0 | {
"file_path": "ivy/ivy/functional/backends/numpy/statistical.py",
"repo_id": "ivy",
"token_count": 3258
} | 20 |
"""Collection of Paddle general functions, wrapped to fit Ivy syntax and
signature."""
# global
from numbers import Number
from typing import Optional, Union, Sequence, Callable, List, Tuple
import paddle
import numpy as np
import multiprocessing as _multiprocessing
# local
import ivy
import ivy.functional.backends.p... | ivy/ivy/functional/backends/paddle/general.py/0 | {
"file_path": "ivy/ivy/functional/backends/paddle/general.py",
"repo_id": "ivy",
"token_count": 10852
} | 21 |
# global
import numpy as np
from numbers import Number
from typing import Union, List, Optional, Sequence, Tuple
import tensorflow as tf
# local
import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from ivy.functional.ivy.creation import (
_asarray_to_native_arrays_and_back,
_asarray_infer_device,
... | ivy/ivy/functional/backends/tensorflow/creation.py/0 | {
"file_path": "ivy/ivy/functional/backends/tensorflow/creation.py",
"repo_id": "ivy",
"token_count": 5492
} | 22 |
import tensorflow as tf
from typing import Literal, Union, Optional, Tuple
from ivy.func_wrapper import with_supported_dtypes, with_unsupported_dtypes
from . import backend_version
import math
@with_unsupported_dtypes({"2.15.0 and below": "uint8"}, backend_version)
def l1_normalize(
x: Union[tf.Tensor, tf.Variabl... | ivy/ivy/functional/backends/tensorflow/experimental/norms.py/0 | {
"file_path": "ivy/ivy/functional/backends/tensorflow/experimental/norms.py",
"repo_id": "ivy",
"token_count": 2993
} | 23 |
# global
import tensorflow as tf
from typing import Tuple, Union, Optional
from collections import namedtuple
from ivy.func_wrapper import with_unsupported_dtypes
from . import backend_version
@with_unsupported_dtypes({"2.15.0 and below": ("complex",)}, backend_version)
def unique_all(
x: Union[tf.Tensor, tf.Vari... | ivy/ivy/functional/backends/tensorflow/set.py/0 | {
"file_path": "ivy/ivy/functional/backends/tensorflow/set.py",
"repo_id": "ivy",
"token_count": 1962
} | 24 |
# global
import torch as torch
backend_version = {"version": torch.__version__.split("+")[0]}
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 *
fro... | ivy/ivy/functional/backends/torch/experimental/__init__.py/0 | {
"file_path": "ivy/ivy/functional/backends/torch/experimental/__init__.py",
"repo_id": "ivy",
"token_count": 174
} | 25 |
# global
torch_scatter = None
from typing import Union, Optional, Sequence
import torch
# local
import ivy
from ivy.functional.ivy.statistical import _get_promoted_type_of_operands
from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
from . import backend_version
# Array API Standard #
# -----... | ivy/ivy/functional/backends/torch/statistical.py/0 | {
"file_path": "ivy/ivy/functional/backends/torch/statistical.py",
"repo_id": "ivy",
"token_count": 4943
} | 26 |
jax_enable_x64 = False
def update(value, toggle):
global jax_enable_x64
if value == "jax_enable_x64":
jax_enable_x64 = toggle
| ivy/ivy/functional/frontends/jax/config.py/0 | {
"file_path": "ivy/ivy/functional/frontends/jax/config.py",
"repo_id": "ivy",
"token_count": 64
} | 27 |
# local
import ivy
from ivy.functional.frontends.jax import Array
from ivy.functional.frontends.jax.func_wrapper import to_ivy_arrays_and_back
from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
from ivy.functional.frontends.jax.numpy import promote_types_of_jax_inputs
from ivy.functional.fronte... | ivy/ivy/functional/frontends/jax/numpy/linalg.py/0 | {
"file_path": "ivy/ivy/functional/frontends/jax/numpy/linalg.py",
"repo_id": "ivy",
"token_count": 1730
} | 28 |
class Tensor:
pass
| ivy/ivy/functional/frontends/mindspore/tensor.py/0 | {
"file_path": "ivy/ivy/functional/frontends/mindspore/tensor.py",
"repo_id": "ivy",
"token_count": 10
} | 29 |
import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
handle_numpy_dtype,
)
@to_ivy_arrays_and_back
def diag(v, k=0):
return ivy.diag(v, k=k)
# diagflat
@to_ivy_arrays_and_back
def diagflat(v, k=0):
ret = ivy.diagflat(v, offset=k)
while len(ivy.shape(ret)) ... | ivy/ivy/functional/frontends/numpy/creation_routines/building_matrices.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/creation_routines/building_matrices.py",
"repo_id": "ivy",
"token_count": 517
} | 30 |
import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
inputs_to_ivy_arrays,
handle_numpy_out,
)
@to_ivy_arrays_and_back
@handle_numpy_out
def compress(condition, a, axis=None, out=None):
condition_arr = ivy.asarray(condition).astype(bool)
if condition_arr.ndi... | ivy/ivy/functional/frontends/numpy/indexing_routines/indexing_like_operations.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/indexing_routines/indexing_like_operations.py",
"repo_id": "ivy",
"token_count": 1373
} | 31 |
# global
import ivy
import numbers
from ivy.functional.frontends.numpy.func_wrapper import (
to_ivy_arrays_and_back,
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
import ivy.functional.frontends.numpy as np_frontend
@handle_numpy_out
@to_ivy_arrays_and_back
@from_zero_dim_arrays_to_scalar
def all(
... | ivy/ivy/functional/frontends/numpy/logic/truth_value_testing.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/logic/truth_value_testing.py",
"repo_id": "ivy",
"token_count": 899
} | 32 |
# local
import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
@to_ivy_arrays_and_back
def flip(m, axis=None):
return ivy.flip(m, axis=axis, out=None)
@to_ivy_arrays_and_back
def fliplr(m):
return ivy.fliplr(m, out=None)
@to_ivy_arrays_and_back
def flipud(m):
return ... | ivy/ivy/functional/frontends/numpy/manipulation_routines/rearranging_elements.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/manipulation_routines/rearranging_elements.py",
"repo_id": "ivy",
"token_count": 257
} | 33 |
# global
import ivy
# local
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_out
@handle_numpy_dtype
@to_ivy_array... | ivy/ivy/functional/frontends/numpy/mathematical_functions/trigonometric_functions.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/mathematical_functions/trigonometric_functions.py",
"repo_id": "ivy",
"token_count": 2472
} | 34 |
# global
import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
@to_ivy_arrays_and_back
def argsort(
x,
/,
*,
axis=-1,
kind=None,
order=None,
):
return ivy.argsort(x, axis=axis)
@to_ivy_arrays_and_back
def lexsort(keys, /, *, axis=-1):
return ivy.le... | ivy/ivy/functional/frontends/numpy/sorting_searching_counting/sorting.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/sorting_searching_counting/sorting.py",
"repo_id": "ivy",
"token_count": 952
} | 35 |
# global
import ivy
from ivy.func_wrapper import with_supported_dtypes
from ivy.functional.frontends.paddle.func_wrapper import (
to_ivy_arrays_and_back,
)
@to_ivy_arrays_and_back
def imag(x):
return ivy.imag(x)
@to_ivy_arrays_and_back
def is_complex(x):
return ivy.is_complex_dtype(x)
@to_ivy_arrays_a... | ivy/ivy/functional/frontends/paddle/attribute.py/0 | {
"file_path": "ivy/ivy/functional/frontends/paddle/attribute.py",
"repo_id": "ivy",
"token_count": 367
} | 36 |
# local
import ivy
from ivy.func_wrapper import with_supported_dtypes
import ivy.functional.frontends.paddle as paddle
from ivy.utils.exceptions import handle_exceptions
from ivy.functional.frontends.paddle.func_wrapper import (
inputs_to_ivy_arrays,
to_ivy_arrays_and_back,
)
# --- Helpers --- #
# -----------... | ivy/ivy/functional/frontends/paddle/nn/functional/loss.py/0 | {
"file_path": "ivy/ivy/functional/frontends/paddle/nn/functional/loss.py",
"repo_id": "ivy",
"token_count": 6740
} | 37 |
# global
from ..stat import * # noqa: F401
| ivy/ivy/functional/frontends/paddle/tensor/stat.py/0 | {
"file_path": "ivy/ivy/functional/frontends/paddle/tensor/stat.py",
"repo_id": "ivy",
"token_count": 16
} | 38 |
from .fft import *
| ivy/ivy/functional/frontends/scipy/fft/__init__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/scipy/fft/__init__.py",
"repo_id": "ivy",
"token_count": 7
} | 39 |
from .optimize import *
| ivy/ivy/functional/frontends/scipy/optimize/__init__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/scipy/optimize/__init__.py",
"repo_id": "ivy",
"token_count": 7
} | 40 |
from . import _classes
from ._classes import *
from . import _criterion
from ._criterion import *
from . import _splitter
from ._splitter import *
from . import _tree
from ._tree import *
| ivy/ivy/functional/frontends/sklearn/tree/__init__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/sklearn/tree/__init__.py",
"repo_id": "ivy",
"token_count": 52
} | 41 |
# global
from builtins import slice as py_slice, range as py_range
# local
import ivy
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,
to_ivy_dtype,
)
from ivy.functional.front... | ivy/ivy/functional/frontends/tensorflow/general_functions.py/0 | {
"file_path": "ivy/ivy/functional/frontends/tensorflow/general_functions.py",
"repo_id": "ivy",
"token_count": 10165
} | 42 |
import ivy
# TODO: Align behavior with tensorflow, modify so that the elements of the raggedTensor
# object are of type EagerTensor
# ensure that the values and row_splits are of type EagerTensor too
# add more initializer methods
class RaggedTensor:
def __init__(self, values, row_partition, internal=False, da... | ivy/ivy/functional/frontends/tensorflow/ragged/ragged.py/0 | {
"file_path": "ivy/ivy/functional/frontends/tensorflow/ragged/ragged.py",
"repo_id": "ivy",
"token_count": 2094
} | 43 |
# local
import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from ivy.functional.frontends.torch.func_wrapper import (
to_ivy_arrays_and_back,
numpy_to_torch_style_args,
to_ivy_shape,
)
import ivy.functional.frontends.torch as torch_frontend
@to_ivy_arrays_and_back
def adjoint(input):
retur... | ivy/ivy/functional/frontends/torch/indexing_slicing_joining_mutating_ops.py/0 | {
"file_path": "ivy/ivy/functional/frontends/torch/indexing_slicing_joining_mutating_ops.py",
"repo_id": "ivy",
"token_count": 7123
} | 44 |
# global
# local
import ivy
from ivy import with_unsupported_dtypes, with_supported_dtypes
from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back
# --- Helpers --- #
# --------------- #
def _handle_padding_shape(padding, n, mode):
padding = tuple(
[
(padding[i * 2], ... | ivy/ivy/functional/frontends/torch/nn/functional/vision_functions.py/0 | {
"file_path": "ivy/ivy/functional/frontends/torch/nn/functional/vision_functions.py",
"repo_id": "ivy",
"token_count": 10626
} | 45 |
import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from .gbm import GBLinear
class DMatrix:
def __init__(
self,
data,
label=None,
*,
weight=None,
base_margin=None,
missing=None,
silent=False,
feature_names=None,
feature_t... | ivy/ivy/functional/frontends/xgboost/core.py/0 | {
"file_path": "ivy/ivy/functional/frontends/xgboost/core.py",
"repo_id": "ivy",
"token_count": 3928
} | 46 |
"""Collection of device Ivy functions."""
# global
import os
import gc
import abc
import math
import psutil
import warnings
import types
from typing import Type, Optional, Tuple
# noinspection PyUnresolvedReferences
try:
import pynvml
try:
pynvml.nvmlInit()
except pynvml.NVMLError:
pass
e... | ivy/ivy/functional/ivy/device.py/0 | {
"file_path": "ivy/ivy/functional/ivy/device.py",
"repo_id": "ivy",
"token_count": 15527
} | 47 |
"""Collection of Ivy functions for nested objects."""
# global
from builtins import map as _map
from typing import Callable, Any, Union, List, Tuple, Optional, Dict, Iterable, Sequence
from collections import UserDict, OrderedDict
# local
import ivy
from ivy.utils.exceptions import handle_exceptions
# Extra #
# ---... | ivy/ivy/functional/ivy/nest.py/0 | {
"file_path": "ivy/ivy/functional/ivy/nest.py",
"repo_id": "ivy",
"token_count": 22927
} | 48 |
"""Collection of Ivy normalization classes."""
# local
import ivy
from ivy.stateful.module import Module
from ivy.stateful.initializers import Zeros, Ones
class LayerNorm(Module):
def __init__(
self,
normalized_shape,
/,
*,
eps: float = 1e-05,
elementwise_affine: b... | ivy/ivy/stateful/norms.py/0 | {
"file_path": "ivy/ivy/stateful/norms.py",
"repo_id": "ivy",
"token_count": 3584
} | 49 |
import logging
logging_modes = ["DEBUG", "INFO", "WARNING", "ERROR"]
# Set up the initial logging mode
logging.basicConfig(level=logging.WARNING)
logging_mode_stack = [logging.WARNING]
def set_logging_mode(mode):
"""Set the current logging mode for Ivy.
Possible modes are 'DEBUG', 'INFO', 'WARNING', 'ERROR'... | ivy/ivy/utils/logging.py/0 | {
"file_path": "ivy/ivy/utils/logging.py",
"repo_id": "ivy",
"token_count": 344
} | 50 |
import ivy
import numpy as np
TOLERANCE_DICT = {
"float16": 1e-2,
"bfloat16": 1e-2,
"float32": 1e-5,
"float64": 1e-5,
None: 1e-5,
}
def assert_all_close(
ret_np,
ret_from_gt_np,
backend: str,
rtol=1e-05,
atol=1e-08,
ground_truth_backend="TensorFlow",
):
"""Match the re... | ivy/ivy_tests/test_ivy/helpers/assertions.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/helpers/assertions.py",
"repo_id": "ivy",
"token_count": 4764
} | 51 |
from .base import FrontendConfigWithBackend
def get_config():
return JaxFrontendConfig()
class JaxFrontendConfig(FrontendConfigWithBackend):
backend_str = "jax"
| ivy/ivy_tests/test_ivy/test_frontends/config/jax.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/config/jax.py",
"repo_id": "ivy",
"token_count": 57
} | 52 |
# local
import ivy
import jax
from ivy_tests.test_ivy.helpers import handle_frontend_test
from ivy.functional.frontends.jax._src.tree_util import tree_leaves, tree_map
import hypothesis.strategies as st
# --- Helpers --- #
# --------------- #
@st.composite
def _tree_dict_strategy(draw):
return draw(tree_strateg... | ivy/ivy_tests/test_ivy/test_frontends/test_jax/test__src/test_tree_util.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_jax/test__src/test_tree_util.py",
"repo_id": "ivy",
"token_count": 1095
} | 53 |
# global
from hypothesis import strategies as st, assume
import numpy as np
import ivy
from jax.numpy import tril, triu, r_, c_
# local
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_frontend_test, BackendHandler
from ...test_numpy.test_indexing_routines.test_inserting_data... | ivy/ivy_tests/test_ivy/test_frontends/test_jax/test_numpy/test_indexing.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_jax/test_numpy/test_indexing.py",
"repo_id": "ivy",
"token_count": 6258
} | 54 |
import pytest
@pytest.fixture(scope="session")
def frontend():
return "numpy"
| ivy/ivy_tests/test_ivy/test_frontends/test_numpy/conftest.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_numpy/conftest.py",
"repo_id": "ivy",
"token_count": 31
} | 55 |
# 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
from ivy_tests.test_ivy.test_functional.test_experimental.test_nn.test_layers import (
_x_and_ifft,
_x_and_rfftn,
)
@handle_frontend_test(
fn_t... | ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_fft/test_discrete_fourier_transform.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_fft/test_discrete_fourier_transform.py",
"repo_id": "ivy",
"token_count": 3733
} | 56 |
# global
import numpy as np
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
# --- Helpers --- #
# --------------- #
# isin
@st.composite
def _isin_data_generation_helper(draw):
dtype_and_x = helpers.dtype_a... | ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_logic/test_array_contents.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_logic/test_array_contents.py",
"repo_id": "ivy",
"token_count": 2013
} | 57 |
# global
import numpy as np
# local
import ivy.functional.frontends.numpy as np_frontend
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_frontend_test, BackendHandler
@handle_frontend_test(
fn_tree="numpy.asmatrix",
arr=helpers.dtype_and_values(min_num_dims=2, max_n... | ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_manipulation_routines/test_changing_kind_of_array.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_manipulation_routines/test_changing_kind_of_array.py",
"repo_id": "ivy",
"token_count": 410
} | 58 |
# 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
# sinc
@handle_frontend_test(
fn_tree="numpy.sinc",
dtype_and_x=helpers.dtype_and_values(available_dtypes=helpers.get_dtypes("float")),
test_wi... | ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_mathematical_functions/test_other_special_functions.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_mathematical_functions/test_other_special_functions.py",
"repo_id": "ivy",
"token_count": 344
} | 59 |
# 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="numpy.argsort",
dtype_x_axis=helpers.dtype_values_axis(
available_dtypes=helpers.get_dtypes("numeric"),
... | ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_sorting_searching_counting/test_sorting.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_sorting_searching_counting/test_sorting.py",
"repo_id": "ivy",
"token_count": 2398
} | 60 |
# global
from hypothesis import given, strategies as st
# local
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_frontend_test
from ivy_tests.test_ivy.test_functional.test_experimental.test_nn.test_layers import (
_x_and_ifftn,
)
# Custom Hypothesis strategy for generati... | ivy/ivy_tests/test_ivy/test_frontends/test_paddle/test_fft.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_paddle/test_fft.py",
"repo_id": "ivy",
"token_count": 7768
} | 61 |
# 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
# --- Helpers --- #
# --------------- #
@st.composite
def _multinomial_helper(draw):
input_dtype_and_x = draw(
helpers.dtype_and_values(
... | ivy/ivy_tests/test_ivy/test_frontends/test_paddle/test_random.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_paddle/test_random.py",
"repo_id": "ivy",
"token_count": 3788
} | 62 |
import pytest
@pytest.fixture(scope="session")
def frontend():
return "scipy"
| ivy/ivy_tests/test_ivy/test_frontends/test_scipy/conftest.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_scipy/conftest.py",
"repo_id": "ivy",
"token_count": 32
} | 63 |
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_frontend_method
CLASS_TREE = "ivy.functional.frontends.sklearn.preprocessing"
@handle_frontend_method(
class_tree=CLASS_TREE + ".LabelEncoder",
init_tree="sklearn.preprocessing.LabelEncoder",
method_name="fit",
... | ivy/ivy_tests/test_ivy/test_frontends/test_sklearn/test_preprocessing/test_label.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_sklearn/test_preprocessing/test_label.py",
"repo_id": "ivy",
"token_count": 520
} | 64 |
# global
from hypothesis import strategies as st, assume
# local
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_frontend_test
from ivy_tests.test_ivy.test_functional.test_experimental.test_nn.test_layers import (
_interp_args,
)
# --- Helpers --- #
# --------------- #
... | ivy/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_image/test_cropping.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_image/test_cropping.py",
"repo_id": "ivy",
"token_count": 1799
} | 65 |
from hypothesis import strategies as st
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_frontend_test
@handle_frontend_test(
fn_tree="torch.bartlett_window",
window_length=helpers.ints(min_value=2, max_value=100),
periodic=st.booleans(),
dtype=helpers.get_dty... | ivy/ivy_tests/test_ivy/test_frontends/test_torch/test_spectral_ops.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_torch/test_spectral_ops.py",
"repo_id": "ivy",
"token_count": 1790
} | 66 |
"""Collection of tests for unified general functions."""
# global
import time
import math
from types import SimpleNamespace
import pytest
from hypothesis import given, assume, strategies as st
import numpy as np
from collections.abc import Sequence
# local
import threading
import ivy
import ivy_tests.test_ivy.helpe... | ivy/ivy_tests/test_ivy/test_functional/test_core/test_general.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_functional/test_core/test_general.py",
"repo_id": "ivy",
"token_count": 29777
} | 67 |
# global
from hypothesis import assume, strategies as st
# local
import ivy
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_test
# --- Helpers --- #
# --------------- #
# float_power_helper
@st.composite
def _float_power_helper(draw, *, available_dtypes=None):
if avai... | ivy/ivy_tests/test_ivy/test_functional/test_experimental/test_core/test_elementwise.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_functional/test_experimental/test_core/test_elementwise.py",
"repo_id": "ivy",
"token_count": 13473
} | 68 |
# global
from hypothesis import strategies as st
# local
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_test
# celu
@handle_test(
fn_tree="functional.ivy.experimental.celu",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("float_an... | ivy/ivy_tests/test_ivy/test_functional/test_experimental/test_nn/test_activations.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_functional/test_experimental/test_nn/test_activations.py",
"repo_id": "ivy",
"token_count": 5906
} | 69 |
import sys
import os
import contextlib
import pytest
import ivy
@pytest.mark.parametrize("trace_mode", ["full", "ivy", "frontend"])
def test_get_trace_mode(trace_mode, backend_fw):
ivy.set_backend(backend_fw)
ivy.set_exception_trace_mode(trace_mode)
ivy.set_exception_trace_mode("ivy")
ivy.utils.assert... | ivy/ivy_tests/test_ivy/test_misc/test_exceptions.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_misc/test_exceptions.py",
"repo_id": "ivy",
"token_count": 1359
} | 70 |
"""Collection of tests for module converters."""
# global
import pytest
from types import SimpleNamespace
from typing import Sequence
# local
import ivy
try:
import torch
import torch.nn as nn
except ImportError:
torch = SimpleNamespace()
torch.tanh = SimpleNamespace
nn = SimpleNamespace()
n... | ivy/ivy_tests/test_ivy/test_stateful/test_converters.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_stateful/test_converters.py",
"repo_id": "ivy",
"token_count": 5945
} | 71 |
import requests
def get_latest_package_version(package_name):
try:
url = f"https://pypi.org/pypi/{package_name}/json"
response = requests.get(url, timeout=10)
response.raise_for_status()
package_info = response.json()
return package_info["info"]["version"]
except reques... | ivy/scripts/run_tests/helpers.py/0 | {
"file_path": "ivy/scripts/run_tests/helpers.py",
"repo_id": "ivy",
"token_count": 1267
} | 72 |
import sys
from pymongo import MongoClient
from get_all_tests import get_all_tests
module_map = {
"core": "test_functional/test_core",
"exp_core": "test_functional/test_experimental/test_core",
"nn": "test_functional/test_experimental/test_nn",
"exp_nn": "test_experimental/test_nn",
"stateful": "t... | ivy/scripts/setup_tests/synchronize_db.py/0 | {
"file_path": "ivy/scripts/setup_tests/synchronize_db.py",
"repo_id": "ivy",
"token_count": 2511
} | 73 |
#!/bin/bash
git submodule update --init --recursive
python3 -m pip install --user -e .
python3 -m pip install pre-commit
git config --global --add safe.directory /workspaces/ivy
( cd /workspaces/ivy/ && pre-commit install)
| ivy/.devcontainer/post_create_commands.sh/0 | {
"file_path": "ivy/.devcontainer/post_create_commands.sh",
"repo_id": "ivy",
"token_count": 75
} | 0 |
cff-version: 1.2.0
title: >-
Ivy: Templated deep learning for inter-framework
portability
message: >-
If you are using Ivy, we would really appreciate it if you
cite it in your work!
authors:
- given-names: Daniel
family-names: Lenton
- given-names: Fabio
family-names: Pardo
- given-names: Fabian
... | ivy/CITATION.cff/0 | {
"file_path": "ivy/CITATION.cff",
"repo_id": "ivy",
"token_count": 588
} | 1 |
docker build --progress=plain --no-cache -t unifyai/ivy:latest-gpu -f DockerfileGPU ..
| ivy/docker/build_gpu_dockerfile.sh/0 | {
"file_path": "ivy/docker/build_gpu_dockerfile.sh",
"repo_id": "ivy",
"token_count": 30
} | 2 |
{% extends "top_level_toc_recursive.rst" %}
{% set ivy_module_map = {
"ivy.stateful": "Framework classes",
"ivy.nested_array": "Nested array",
"ivy.utils": "Utils",
"ivy_tests.test_ivy.helpers": "Testing",
} %}
{% block name %}{{ivy_module_map[fullname] | escape | underline}}{% endblock %}
| ivy/docs/_templates/top_ivy_toc.rst/0 | {
"file_path": "ivy/docs/_templates/top_ivy_toc.rst",
"repo_id": "ivy",
"token_count": 136
} | 3 |
Building the Docs Pipeline
==========================
.. _Sphinx: http://sphinx-doc.org/
.. _Sphinx configuration file: https://www.sphinx-doc.org/en/master/usage/configuration.html
.. _autosummary: https://www.sphinx-doc.org/en/master/usage/extensions/autosummary.html
.. _doc-builder repository: https://github.com/un... | ivy/docs/overview/deep_dive/building_the_docs_pipeline.rst/0 | {
"file_path": "ivy/docs/overview/deep_dive/building_the_docs_pipeline.rst",
"repo_id": "ivy",
"token_count": 4494
} | 4 |
Ivy Frontend Tests
==================
.. _`here`: ../design/ivy_as_a_transpiler.rst
.. _`ivy frontends tests thread`: https://discord.com/channels/799879767196958751/1190246804940402738
.. _`test ivy`: https://github.com/unifyai/ivy/tree/db9a22d96efd3820fb289e9997eb41dda6570868/ivy_tests/test_ivy
.. _`test_frontend_fu... | ivy/docs/overview/deep_dive/ivy_frontends_tests.rst/0 | {
"file_path": "ivy/docs/overview/deep_dive/ivy_frontends_tests.rst",
"repo_id": "ivy",
"token_count": 14275
} | 5 |
.. _`RWorks Multi-Vendor Compiler Frameworks`:
Multi-Vendor Compiler Frameworks
================================
.. _`Tensor Virtual Machine (TVM)`: https://tvm.apache.org/
.. _`actively exploring`: https://discuss.tvm.apache.org/t/google-lasted-work-mlir-primer/1721
.. _`MLIR`: https://mlir.llvm.org/
.. _`Accelerate... | ivy/docs/overview/related_work/multi_vendor_compiler_frameworks.rst/0 | {
"file_path": "ivy/docs/overview/related_work/multi_vendor_compiler_frameworks.rst",
"repo_id": "ivy",
"token_count": 869
} | 6 |
# global
import abc
from typing import Optional, Union, Literal
# local
import ivy
# ToDo: implement all methods here as public instance methods
class _ArrayWithActivations(abc.ABC):
def relu(
self: ivy.Array,
/,
*,
complex_mode: Literal["split", "magnitude", "jax"] = "jax",
... | ivy/ivy/data_classes/array/activations.py/0 | {
"file_path": "ivy/ivy/data_classes/array/activations.py",
"repo_id": "ivy",
"token_count": 5617
} | 7 |
# global
import abc
class _ArrayWithImageExperimental(abc.ABC):
pass
| ivy/ivy/data_classes/array/experimental/image.py/0 | {
"file_path": "ivy/ivy/data_classes/array/experimental/image.py",
"repo_id": "ivy",
"token_count": 26
} | 8 |
# global
import abc
from typing import Union, Optional, Literal, Tuple, List, Sequence
# local
import ivy
inf = float("inf")
class _ArrayWithLinearAlgebra(abc.ABC):
def matmul(
self: ivy.Array,
x2: Union[ivy.Array, ivy.NativeArray],
/,
*,
transpose_a: bool = False,
... | ivy/ivy/data_classes/array/linear_algebra.py/0 | {
"file_path": "ivy/ivy/data_classes/array/linear_algebra.py",
"repo_id": "ivy",
"token_count": 19047
} | 9 |
# global
from typing import Optional, Union, List, Tuple, Dict, Sequence
from numbers import Number
import numpy as np
# local
import ivy
from ivy.data_classes.container.base import ContainerBase
class _ContainerWithCreation(ContainerBase):
@staticmethod
def _static_arange(
start: Union[Number, ivy.C... | ivy/ivy/data_classes/container/creation.py/0 | {
"file_path": "ivy/ivy/data_classes/container/creation.py",
"repo_id": "ivy",
"token_count": 30151
} | 10 |
# global
from typing import Optional, Union, List, Dict
# local
import ivy
from ivy.data_classes.container.base import ContainerBase
class _ContainerWithLossesExperimental(ContainerBase):
@staticmethod
def _static_l1_loss(
input: Union[ivy.Container, ivy.Array, ivy.NativeArray],
target: Union... | ivy/ivy/data_classes/container/experimental/losses.py/0 | {
"file_path": "ivy/ivy/data_classes/container/experimental/losses.py",
"repo_id": "ivy",
"token_count": 22860
} | 11 |
# global
from typing import Optional, List, Union
# local
import ivy
from ivy.data_classes.container.base import ContainerBase
# ToDo: implement all methods here as public instance methods
# noinspection PyMissingConstructor
class _ContainerWithNorms(ContainerBase):
def layer_norm(
self: Union[ivy.Array... | ivy/ivy/data_classes/container/norms.py/0 | {
"file_path": "ivy/ivy/data_classes/container/norms.py",
"repo_id": "ivy",
"token_count": 1604
} | 12 |
# global
import abc
from typing import List, Tuple
# local
import ivy
class NestedArrayBase(abc.ABC):
"""Base class for nested array objects."""
def __init__(self, data, nested_rank, inner_shape, dtype, device, internal=False):
if not internal:
raise RuntimeError(
"Nested... | ivy/ivy/data_classes/nested_array/base.py/0 | {
"file_path": "ivy/ivy/data_classes/nested_array/base.py",
"repo_id": "ivy",
"token_count": 5340
} | 13 |
use super::{ArrayElement, ElementType, PrimitiveType};
use crate::{c_lib, Error, Result};
use pyo3::prelude::*;
#[derive(Clone, PartialEq, Eq, Debug)]
#[pyclass(unsendable)]
pub struct ArrayShape {
ty: ElementType,
dims: Vec<i64>,
}
impl ArrayShape {
/// Create a new array shape.
pub fn new<E: ArrayEl... | ivy/ivy/engines/XLA/rust_api/src/wrappers/shape.rs/0 | {
"file_path": "ivy/ivy/engines/XLA/rust_api/src/wrappers/shape.rs",
"repo_id": "ivy",
"token_count": 3508
} | 14 |
# global
from typing import Union, Optional
import jax
import jax.numpy as jnp
# local
import ivy
from ivy import (
default_float_dtype,
is_float_dtype,
)
from ivy import promote_types_of_inputs
from ivy.functional.backends.jax import JaxArray
from ivy.func_wrapper import with_unsupported_dtypes
from . import... | ivy/ivy/functional/backends/jax/elementwise.py/0 | {
"file_path": "ivy/ivy/functional/backends/jax/elementwise.py",
"repo_id": "ivy",
"token_count": 7743
} | 15 |
# global
import jax.numpy as jnp
from typing import Optional, Tuple
# local
from ivy.functional.backends.jax import JaxArray
def unravel_index(
indices: JaxArray,
shape: Tuple[int],
/,
*,
out: Optional[JaxArray] = None,
) -> Tuple[JaxArray]:
return jnp.unravel_index(indices.astype(jnp.int32),... | ivy/ivy/functional/backends/jax/experimental/searching.py/0 | {
"file_path": "ivy/ivy/functional/backends/jax/experimental/searching.py",
"repo_id": "ivy",
"token_count": 133
} | 16 |
# global
import jax.numpy as jnp
from typing import Union, Optional, Sequence
# local
import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from ivy.functional.backends.jax import JaxArray
from . import backend_version
# Array API Standard #
# -------------------#
def min(
x: JaxArray,
/,
*,
... | ivy/ivy/functional/backends/jax/statistical.py/0 | {
"file_path": "ivy/ivy/functional/backends/jax/statistical.py",
"repo_id": "ivy",
"token_count": 3184
} | 17 |
# global
import mxnet as mx
from typing import Union, Optional, Tuple, Literal, List, Sequence
from collections import namedtuple
# local
from ivy import inf
from ivy.utils.exceptions import IvyNotImplementedException
def cholesky(
x: Union[(None, mx.ndarray.NDArray)],
/,
*,
upper: bool = False,
... | ivy/ivy/functional/backends/mxnet/linear_algebra.py/0 | {
"file_path": "ivy/ivy/functional/backends/mxnet/linear_algebra.py",
"repo_id": "ivy",
"token_count": 3593
} | 18 |
# global
from typing import Union, Optional
import numpy as np
# local
import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from ivy import promote_types_of_inputs
from ivy.functional.backends.numpy.helpers import _scalar_output_to_0d_array
from . import backend_version
@_scalar_output_to_0d_array
def abs... | ivy/ivy/functional/backends/numpy/elementwise.py/0 | {
"file_path": "ivy/ivy/functional/backends/numpy/elementwise.py",
"repo_id": "ivy",
"token_count": 10442
} | 19 |
# global
from typing import Optional, Tuple
import numpy as np
# local
from ivy.func_wrapper import with_supported_dtypes
from . import backend_version
@with_supported_dtypes({"1.26.3 and below": ("int32", "int64")}, backend_version)
def unravel_index(
indices: np.ndarray,
shape: Tuple[int],
/,
*,
... | ivy/ivy/functional/backends/numpy/experimental/searching.py/0 | {
"file_path": "ivy/ivy/functional/backends/numpy/experimental/searching.py",
"repo_id": "ivy",
"token_count": 196
} | 20 |
# global
import numpy as np
from typing import Optional, Literal, Union, List
# local
import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from . import backend_version
def argsort(
x: np.ndarray,
/,
*,
axis: int = -1,
descending: bool = False,
stable: bool = True,
out: Optiona... | ivy/ivy/functional/backends/numpy/sorting.py/0 | {
"file_path": "ivy/ivy/functional/backends/numpy/sorting.py",
"repo_id": "ivy",
"token_count": 1121
} | 21 |
import tensorflow as tf
def if_else(cond, body_fn, orelse_fn, vars):
# back-compatibility
if isinstance(cond, bool):
v = cond
def cond(*_):
return v
cond = bool(cond(**vars))
return tf.cond(cond, lambda: body_fn(**vars), lambda: orelse_fn(**vars))
# use pythonic plac... | ivy/ivy/functional/backends/tensorflow/control_flow_ops.py/0 | {
"file_path": "ivy/ivy/functional/backends/tensorflow/control_flow_ops.py",
"repo_id": "ivy",
"token_count": 691
} | 22 |
# global
from collections import namedtuple
from typing import (
Iterable,
Union,
Optional,
Sequence,
Tuple,
NamedTuple,
List,
Literal,
Callable,
Any,
)
from numbers import Number
import tensorflow as tf
# local
from ivy.func_wrapper import with_unsupported_dtypes, handle_out_ar... | ivy/ivy/functional/backends/tensorflow/experimental/manipulation.py/0 | {
"file_path": "ivy/ivy/functional/backends/tensorflow/experimental/manipulation.py",
"repo_id": "ivy",
"token_count": 8667
} | 23 |
# global
from numbers import Number
from typing import Optional, Union, Tuple
import tensorflow as tf
import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from . import backend_version
# Array API Standard #
# ------------------ #
@with_unsupported_dtypes({"2.15.0 and below": ("complex",)}, backend_vers... | ivy/ivy/functional/backends/tensorflow/searching.py/0 | {
"file_path": "ivy/ivy/functional/backends/tensorflow/searching.py",
"repo_id": "ivy",
"token_count": 1820
} | 24 |
# global
from typing import Union, Optional
from math import pi
import torch
# local
import ivy
from ivy.func_wrapper import (
with_unsupported_dtypes,
with_supported_dtypes,
handle_numpy_arrays_in_specific_backend,
)
from ivy import promote_types_of_inputs
from . import backend_version
def _cast_for_una... | ivy/ivy/functional/backends/torch/elementwise.py/0 | {
"file_path": "ivy/ivy/functional/backends/torch/elementwise.py",
"repo_id": "ivy",
"token_count": 12950
} | 25 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.