text stringlengths 17 362k | id stringlengths 13 115 | metadata dict | __index_level_0__ int64 0 75 |
|---|---|---|---|
import pytest
import ivy
from ivy.functional.frontends.sklearn.utils.multiclass import type_of_target
# not suitable for usual frontend testing
@pytest.mark.parametrize(
("y", "label"),
[
([1.2], "continuous"),
([1], "binary"),
([1, 2], "binary"),
([1, 2, 3], "multiclass"),
... | ivy/ivy_tests/test_ivy/test_frontends/test_sklearn/test_utils/test_multiclass.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_sklearn/test_utils/test_multiclass.py",
"repo_id": "ivy",
"token_count": 343
} | 59 |
# global
from hypothesis import assume, strategies as st
from ivy.func_wrapper import output_to_native_arrays
# 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_core.test_linalg import (
_ge... | ivy/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_keras/test_backend.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_keras/test_backend.py",
"repo_id": "ivy",
"token_count": 5755
} | 60 |
# global
from hypothesis import strategies as st
# local
import ivy
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_frontend_method
import pytest
CLASS_TREE = "ivy.functional.frontends.tensorflow.tensor.TensorShape"
# __add__
@pytest.mark.skip("TODO: test needs implementin... | ivy/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_tensorshape.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_tensorshape.py",
"repo_id": "ivy",
"token_count": 997
} | 61 |
# global
import numpy as np
from hypothesis import strategies as st
from ivy_tests.test_ivy.helpers import handle_frontend_test
# local
import ivy_tests.test_ivy.helpers as helpers
@handle_frontend_test(
fn_tree="torch.nn.functional.alpha_dropout",
dtype_and_x=helpers.dtype_and_values(
available_dtyp... | ivy/ivy_tests/test_ivy/test_frontends/test_torch/test_nn/test_functional/test_dropout_functions.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_torch/test_nn/test_functional/test_dropout_functions.py",
"repo_id": "ivy",
"token_count": 3279
} | 62 |
# 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 _elemwise_helper(draw):
value_strategy = st.one_of(
helpers.dtype_and_values(
... | ivy/ivy_tests/test_ivy/test_frontends/test_torch/test_utilities.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_torch/test_utilities.py",
"repo_id": "ivy",
"token_count": 1752
} | 63 |
"""Collection of tests for manipulation functions."""
# global
import numpy as np
from hypothesis import strategies as st, assume
# local
import ivy
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_test
# --- Helpers --- #
# --------------- #
@st.composite
def _arrays_idx... | ivy/ivy_tests/test_ivy/test_functional/test_core/test_manipulation.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_functional/test_core/test_manipulation.py",
"repo_id": "ivy",
"token_count": 10959
} | 64 |
# global
import math
from hypothesis import strategies as st
from hypothesis import assume
import numpy as np
import pytest
import itertools
import sys
# local
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_test, BackendHandler
import ivy
# --- Helpers --- #
# ------------... | ivy/ivy_tests/test_ivy/test_functional/test_experimental/test_core/test_linalg.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_functional/test_experimental/test_core/test_linalg.py",
"repo_id": "ivy",
"token_count": 33178
} | 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_test
import ivy
# --- Helpers --- #
# --------------- #
@st.composite
def _group_norm_helper(draw):
data_format = draw(st.sampled_from(["NSC", "NCS"]))
shape =... | ivy/ivy_tests/test_ivy/test_functional/test_experimental/test_nn/test_norms.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_functional/test_experimental/test_nn/test_norms.py",
"repo_id": "ivy",
"token_count": 4702
} | 66 |
import ivy
import numpy as np
import pytest
@pytest.mark.parametrize(
("weights", "factors", "projections", "true_res"),
[
(
(2, 3),
[[[1, 1], [1, 0]], [[2, 1], [1, 2]], [[1, 1], [1, 0], [1, 0]]],
[[[1, 0], [0, 1]], [[1, 0], [0, 0], [0, -1]]],
[[[7, 4, ... | ivy/ivy_tests/test_ivy/test_misc/test_factorized_tensor/test_parafac2_tensor.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_misc/test_factorized_tensor/test_parafac2_tensor.py",
"repo_id": "ivy",
"token_count": 3028
} | 67 |
"""Collection of tests for losses."""
# global
from hypothesis import strategies as st
# local
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_method
# Binary Cross Entropy Loss
@handle_method(
method_tree="stateful.losses.BinaryCrossEntropyLoss.__call__",
dtype_an... | ivy/ivy_tests/test_ivy/test_stateful/test_losses.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_stateful/test_losses.py",
"repo_id": "ivy",
"token_count": 3860
} | 68 |
import astunparse
import ast
import json
import sys
import subprocess
import os
import logging
from shared import BackendNativeObject
_backend_reference = "tensorflow"
_backend_import_alias = "tf"
_target_backend = ""
_config = None
_not_imlpemented_exc_name = "NotImplementedError"
_decorator_black_list = [
"wi... | ivy/scripts/backend_generation/tree_generation.py/0 | {
"file_path": "ivy/scripts/backend_generation/tree_generation.py",
"repo_id": "ivy",
"token_count": 4940
} | 69 |
# Run Tests
import os
import sys
from pymongo import MongoClient
from pymongo.errors import WriteError
import json
import old_run_test_helpers as old_helpers
from helpers import (
get_latest_package_version,
get_submodule_and_function_name,
)
from get_all_tests import BACKENDS
if __name__ == "__main__":
r... | ivy/scripts/run_tests/run_tests.py/0 | {
"file_path": "ivy/scripts/run_tests/run_tests.py",
"repo_id": "ivy",
"token_count": 5402
} | 70 |
#!/bin/bash -e
git checkout "$1"
git remote add upstream https://github.com/unifyai/ivy.git || true
git fetch upstream
git merge upstream/main --no-edit
git push
| ivy/scripts/shell/merge_with_upstream.sh/0 | {
"file_path": "ivy/scripts/shell/merge_with_upstream.sh",
"repo_id": "ivy",
"token_count": 52
} | 71 |
{
"ivy": {
"functional": ["negative.so",
"bitwise_xor.so",
"vander.so",
"std.so",
"atanh.so",
"argmin.so",
"asinh.so",
"squeeze.so",
"square.so",
"matrix_norm.so",
"not_equal.so",
"log.so",
"expand_dims.so",
... | ivy/wrappers.json/0 | {
"file_path": "ivy/wrappers.json",
"repo_id": "ivy",
"token_count": 2925
} | 72 |
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Remote Python 3.10.0 Docker (unifyai/ivy:latest)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests=... | ivy/.idea/ivy.iml/0 | {
"file_path": "ivy/.idea/ivy.iml",
"repo_id": "ivy",
"token_count": 224
} | 0 |
## Frontend Task Checklist
#### IMPORTANT NOTICE 🚨:
The [Ivy Docs](https://unify.ai/docs/ivy/) represent the ground truth for the task descriptions and this checklist should only be used as a supplementary item to aid with the review process.
Please note that the contributor is not expected to understand everything ... | ivy/automation_tools/checklists/frontend_checklist.md/0 | {
"file_path": "ivy/automation_tools/checklists/frontend_checklist.md",
"repo_id": "ivy",
"token_count": 1209
} | 1 |
#!/bin/bash
docker build -t unifyai/ivy:latest --no-cache -f Dockerfile ..
docker build -t unifyai/ivy:latest-gpu --no-cache -f DockerfileGPU ..
| ivy/docker/rebuild_all_dockerfiles.sh/0 | {
"file_path": "ivy/docker/rebuild_all_dockerfiles.sh",
"repo_id": "ivy",
"token_count": 54
} | 2 |
Contributor Rewards
===================
We award a range of badges, each designed to formally recognize the specific achievements of our contributors in various key areas of ivy's development.
Badges
~~~~~~~
**Debugging Dynamos** - These badges are earned by creating useful issues. If you find a problem that isn't l... | ivy/docs/overview/contributing/contributor_rewards.rst/0 | {
"file_path": "ivy/docs/overview/contributing/contributor_rewards.rst",
"repo_id": "ivy",
"token_count": 1581
} | 3 |
Docstring Examples
==================
.. _`repo`: https://github.com/unifyai/ivy
.. _`discord`: https://discord.gg/sXyFF8tDtm
.. _`docstring examples thread`: https://discord.com/channels/799879767196958751/1189906990307233822
After writing the general docstrings, the final step is to add helpful examples to the docs... | ivy/docs/overview/deep_dive/docstring_examples.rst/0 | {
"file_path": "ivy/docs/overview/deep_dive/docstring_examples.rst",
"repo_id": "ivy",
"token_count": 11360
} | 4 |
Superset Behaviour
==================
.. _`Array API Standard`: https://data-apis.org/array-api/latest/
.. _`discord`: https://discord.gg/sXyFF8tDtm
.. _`superset behavior thread`: https://discord.com/channels/799879767196958751/1189905520686014514
.. _`partial_mixed_handler`: https://github.com/unifyai/ivy/blob/a0791... | ivy/docs/overview/deep_dive/superset_behaviour.rst/0 | {
"file_path": "ivy/docs/overview/deep_dive/superset_behaviour.rst",
"repo_id": "ivy",
"token_count": 6358
} | 5 |
One liners
----------
.. grid:: 1 1 3 3
:gutter: 4
.. grid-item-card:: ``ivy.trace_graph()``
:link: one_liners/trace.rst
Traces a ``Callable`` or set of them into an Ivy graph.
.. grid-item-card:: ``ivy.transpile()``
:link: one_liners/transpile.rst
Transpiles a ``Callabl... | ivy/docs/overview/one_liners.rst/0 | {
"file_path": "ivy/docs/overview/one_liners.rst",
"repo_id": "ivy",
"token_count": 316
} | 6 |
Contributor Leaderboard
=======================
This page lists all of our amazing Contributors who have contributed to the project! We are grateful for your contributions and we hope to see you grow with the project! The ranks listed here are based on the `level of contribution <contributing/volunteer_program.rst>`_\... | ivy/docs/overview/volunteer_ranks.rst/0 | {
"file_path": "ivy/docs/overview/volunteer_ranks.rst",
"repo_id": "ivy",
"token_count": 1079
} | 7 |
# global
import abc
from typing import Union, Optional, Any
import ivy
# ToDo: implement all methods here as public instance methods
class _ArrayWithDevice(abc.ABC):
def dev(
self: ivy.Array, *, as_native: bool = False
) -> Union[ivy.Device, ivy.NativeDevice]:
"""ivy.Array instance method v... | ivy/ivy/data_classes/array/device.py/0 | {
"file_path": "ivy/ivy/data_classes/array/device.py",
"repo_id": "ivy",
"token_count": 918
} | 8 |
# global
import abc
from typing import Optional, Union, Tuple
# local
import ivy
class _ArrayWithNormsExperimental(abc.ABC):
def l1_normalize(
self: ivy.Array,
axis: Optional[Union[int, Tuple[int, ...]]] = None,
out: Optional[ivy.Array] = None,
) -> ivy.Array:
"""Normalize the... | ivy/ivy/data_classes/array/experimental/norms.py/0 | {
"file_path": "ivy/ivy/data_classes/array/experimental/norms.py",
"repo_id": "ivy",
"token_count": 4754
} | 9 |
# global
import abc
from numbers import Number
from typing import Optional, Union, Tuple
# local
import ivy
class _ArrayWithSearching(abc.ABC):
def argmax(
self: ivy.Array,
/,
*,
axis: Optional[int] = None,
keepdims: bool = False,
dtype: Optional[Union[ivy.Dtype, i... | ivy/ivy/data_classes/array/searching.py/0 | {
"file_path": "ivy/ivy/data_classes/array/searching.py",
"repo_id": "ivy",
"token_count": 4169
} | 10 |
# global
from typing import Union, Optional, List, Dict, Literal
# local
import ivy
from ivy.data_classes.container.base import ContainerBase
class _ContainerWithActivationExperimental(ContainerBase):
@staticmethod
def static_logit(
x: Union[float, int, ivy.Container],
/,
*,
e... | ivy/ivy/data_classes/container/experimental/activations.py/0 | {
"file_path": "ivy/ivy/data_classes/container/experimental/activations.py",
"repo_id": "ivy",
"token_count": 33000
} | 11 |
from ivy.data_classes.container.base import ContainerBase
class _ContainerWithSetExperimental(ContainerBase):
pass
| ivy/ivy/data_classes/container/experimental/set.py/0 | {
"file_path": "ivy/ivy/data_classes/container/experimental/set.py",
"repo_id": "ivy",
"token_count": 33
} | 12 |
# global
from typing import Optional, Union, List, Dict, Sequence
# local
import ivy
from ivy.data_classes.container.base import ContainerBase
# ToDo: implement all methods here as public instance methods
class _ContainerWithStatistical(ContainerBase):
@staticmethod
def _static_min(
x: ivy.Container... | ivy/ivy/data_classes/container/statistical.py/0 | {
"file_path": "ivy/ivy/data_classes/container/statistical.py",
"repo_id": "ivy",
"token_count": 30430
} | 13 |
extern crate bindgen;
use std::env;
use std::path::{Path, PathBuf};
fn make_shared_lib<P: AsRef<Path>>(xla_dir: P) {
let os = env::var("CARGO_CFG_TARGET_OS").expect("Unable to get TARGET_OS");
println!("cargo:rerun-if-changed=xla_rs/xla_rs.cc");
println!("cargo:rerun-if-changed=xla_rs/xla_rs.h");
matc... | ivy/ivy/engines/XLA/rust_api/build.rs/0 | {
"file_path": "ivy/ivy/engines/XLA/rust_api/build.rs",
"repo_id": "ivy",
"token_count": 1358
} | 14 |
from . import XLA
from .XLA import *
| ivy/ivy/engines/__init__.py/0 | {
"file_path": "ivy/ivy/engines/__init__.py",
"repo_id": "ivy",
"token_count": 13
} | 15 |
from ivy.utils.exceptions import IvyNotImplementedException
def if_else(cond, body_fn, orelse_fn, vars):
raise IvyNotImplementedException()
def while_loop(test_fn, body_fn, vars):
raise IvyNotImplementedException()
| ivy/ivy/functional/backends/mxnet/control_flow_ops.py/0 | {
"file_path": "ivy/ivy/functional/backends/mxnet/control_flow_ops.py",
"repo_id": "ivy",
"token_count": 80
} | 16 |
from typing import Union, Optional, Tuple
import mxnet as mx
from ivy.utils.exceptions import IvyNotImplementedException
def l2_normalize(
x: Union[(None, mx.ndarray.NDArray)],
/,
*,
axis: Optional[int] = None,
out: Optional[None] = None,
) -> None:
raise IvyNotImplementedException()
def ba... | ivy/ivy/functional/backends/mxnet/experimental/norms.py/0 | {
"file_path": "ivy/ivy/functional/backends/mxnet/experimental/norms.py",
"repo_id": "ivy",
"token_count": 779
} | 17 |
from typing import Tuple, Union, Optional
import mxnet as mx
from ivy.utils.exceptions import IvyNotImplementedException
def unique_all(
x: Union[(None, mx.ndarray.NDArray)], /, *, axis: Optional[int] = None
) -> Tuple[
(
Union[(None, mx.ndarray.NDArray)],
Union[(None, mx.ndarray.NDArray)],
... | ivy/ivy/functional/backends/mxnet/set.py/0 | {
"file_path": "ivy/ivy/functional/backends/mxnet/set.py",
"repo_id": "ivy",
"token_count": 464
} | 18 |
"""Paddle activation functions.
Collection of Paddle activation functions, wrapped to fit Ivy syntax and
signature.
"""
from typing import Optional, Union, Literal
# global
import paddle
import paddle.nn.functional as F
# local
import ivy.functional.backends.paddle as paddle_backend
import ivy
from ivy.func_wrapper... | ivy/ivy/functional/backends/paddle/activations.py/0 | {
"file_path": "ivy/ivy/functional/backends/paddle/activations.py",
"repo_id": "ivy",
"token_count": 2467
} | 19 |
# global
from typing import Optional, Union, Tuple, List, Literal, Sequence, Callable
import paddle
from ivy.functional.ivy.layers import (
_handle_padding,
_depth_max_pooling_helper,
_validate_max_pool_params,
)
from ivy.utils.exceptions import IvyNotImplementedException, IvyValueError
from ivy.func_wrappe... | ivy/ivy/functional/backends/paddle/experimental/layers.py/0 | {
"file_path": "ivy/ivy/functional/backends/paddle/experimental/layers.py",
"repo_id": "ivy",
"token_count": 9647
} | 20 |
# global
from numbers import Number
from typing import Union, Optional, Tuple, List, Sequence, Iterable
import math
import paddle
# local
import ivy
import ivy.functional.backends.paddle as paddle_backend
from ivy.func_wrapper import (
with_unsupported_device_and_dtypes,
with_unsupported_dtypes,
with_suppo... | ivy/ivy/functional/backends/paddle/manipulation.py/0 | {
"file_path": "ivy/ivy/functional/backends/paddle/manipulation.py",
"repo_id": "ivy",
"token_count": 7636
} | 21 |
# global
import tensorflow as tf
from typing import Union, Optional
# invert_permutation
def invert_permutation(
x: Union[tf.Tensor, tf.Variable, list, tuple],
/,
) -> Union[tf.Tensor, tf.Variable]:
return tf.cast(tf.math.invert_permutation(x), tf.int64)
# lexsort
def lexsort(
keys: Union[tf.Tensor,... | ivy/ivy/functional/backends/tensorflow/experimental/sorting.py/0 | {
"file_path": "ivy/ivy/functional/backends/tensorflow/experimental/sorting.py",
"repo_id": "ivy",
"token_count": 494
} | 22 |
from .experimental import random, statistical
from . import elementwise
from .elementwise import *
from .experimental.random import *
from .experimental.statistical import *
name = "tf_probability"
incompatible_sub_backends = ()
| ivy/ivy/functional/backends/tensorflow/sub_backends/tf_probability/__init__.py/0 | {
"file_path": "ivy/ivy/functional/backends/tensorflow/sub_backends/tf_probability/__init__.py",
"repo_id": "ivy",
"token_count": 63
} | 23 |
import xformers
from . import layers
from .layers import *
name = "xformers"
incompatible_sub_backends = ()
| ivy/ivy/functional/backends/torch/sub_backends/xformers/__init__.py/0 | {
"file_path": "ivy/ivy/functional/backends/torch/sub_backends/xformers/__init__.py",
"repo_id": "ivy",
"token_count": 38
} | 24 |
# global
import ivy
from ivy.functional.frontends.jax.func_wrapper import to_ivy_arrays_and_back
@to_ivy_arrays_and_back
def cond(pred, true_fun, false_fun, *operands, operand=None, linear=None):
if operand is not None:
if operands:
raise ivy.utils.exceptions.IvyException(
"if ... | ivy/ivy/functional/frontends/jax/lax/control_flow_operators.py/0 | {
"file_path": "ivy/ivy/functional/frontends/jax/lax/control_flow_operators.py",
"repo_id": "ivy",
"token_count": 1124
} | 25 |
from ivy.functional.frontends.jax.numpy import asarray
from ivy.functional.frontends.numpy import (
dtype,
generic,
number,
inexact,
complexfloating,
floating,
integer,
signedinteger,
unsignedinteger,
)
class _ScalarMeta(type):
def __hash__(self):
return hash(self.dtype... | ivy/ivy/functional/frontends/jax/numpy/scalars.py/0 | {
"file_path": "ivy/ivy/functional/frontends/jax/numpy/scalars.py",
"repo_id": "ivy",
"token_count": 656
} | 26 |
import ivy
from ivy.functional.frontends.mxnet.func_wrapper import (
to_ivy_arrays_and_back,
)
from ivy.functional.frontends.numpy.func_wrapper import handle_numpy_dtype
@handle_numpy_dtype
@to_ivy_arrays_and_back
def array(object, dtype=None, ctx=None):
if not ivy.is_array(object) and not dtype:
retu... | ivy/ivy/functional/frontends/mxnet/numpy/creation.py/0 | {
"file_path": "ivy/ivy/functional/frontends/mxnet/numpy/creation.py",
"repo_id": "ivy",
"token_count": 171
} | 27 |
# global
import ivy
from ivy.functional.frontends.numpy.func_wrapper import (
outputs_to_frontend_arrays,
to_ivy_arrays_and_back,
handle_numpy_dtype,
)
class nd_grid:
def __init__(self, sparse=False):
self.sparse = sparse
self.grids = []
self.shapes = []
def __getitem__(se... | ivy/ivy/functional/frontends/numpy/creation_routines/numerical_ranges.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/creation_routines/numerical_ranges.py",
"repo_id": "ivy",
"token_count": 2563
} | 28 |
from . import arithmetic_operations
from .arithmetic_operations import *
from . import trigonometric_functions
from .trigonometric_functions import *
from . import hyperbolic_functions
from .hyperbolic_functions import *
from . import rounding
from .rounding import *
from . import sums_products_differences
from .sums_p... | ivy/ivy/functional/frontends/numpy/mathematical_functions/__init__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/mathematical_functions/__init__.py",
"repo_id": "ivy",
"token_count": 239
} | 29 |
# global
import struct
import warnings
# local
import ivy
import ivy.functional.frontends.numpy as np_frontend
from ivy.functional.frontends.numpy.func_wrapper import _to_ivy_array
from ivy.func_wrapper import (
with_supported_device_and_dtypes,
)
# --- Classes ---#
# ---------------#
class ndarray:
def __... | ivy/ivy/functional/frontends/numpy/ndarray/ndarray.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/ndarray/ndarray.py",
"repo_id": "ivy",
"token_count": 11430
} | 30 |
import ivy
from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
from ivy.func_wrapper import with_supported_dtypes
@with_supported_dtypes({"1.26.3 and below": ("int64",)}, "numpy")
@to_ivy_arrays_and_back
def bincount(x, /, weights=None, minlength=0):
return ivy.bincount(x, weights=weigh... | ivy/ivy/functional/frontends/numpy/statistics/histograms.py/0 | {
"file_path": "ivy/ivy/functional/frontends/numpy/statistics/histograms.py",
"repo_id": "ivy",
"token_count": 132
} | 31 |
# global
import ivy
from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
from ivy.functional.frontends.paddle import promote_types_of_paddle_inputs
from ivy.functional.frontends.paddle.func_wrapper import (
to_ivy_arrays_and_back,
)
@with_supported_dtypes({"2.4.1 and above": ("int64",)}, "p... | ivy/ivy/functional/frontends/paddle/linalg.py/0 | {
"file_path": "ivy/ivy/functional/frontends/paddle/linalg.py",
"repo_id": "ivy",
"token_count": 3636
} | 32 |
# global
import ivy
from ivy.func_wrapper import with_supported_dtypes
from ivy.func_wrapper import with_supported_device_and_dtypes, with_unsupported_dtypes
from ivy.functional.frontends.paddle.func_wrapper import (
to_ivy_arrays_and_back,
)
@with_supported_dtypes(
{"2.6.0 and below": ("float32", "float64")}... | ivy/ivy/functional/frontends/paddle/random.py/0 | {
"file_path": "ivy/ivy/functional/frontends/paddle/random.py",
"repo_id": "ivy",
"token_count": 1565
} | 33 |
from . import func_wrapper
from .func_wrapper import *
from . import series
from .series import *
from . import index
from .index import *
from . import dataframe
from .dataframe import *
from . import generic
from .generic import *
| ivy/ivy/functional/frontends/pandas/__init__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/pandas/__init__.py",
"repo_id": "ivy",
"token_count": 61
} | 34 |
import ivy
from ._splitter import SplitRecord
EPSILON = ivy.finfo(ivy.double).eps
INFINITY = ivy.inf
INTPTR_MAX = ivy.iinfo(ivy.int32).max
TREE_LEAF = -1
TREE_UNDEFINED = -2
_TREE_LEAF = TREE_LEAF
_TREE_UNDEFINED = TREE_UNDEFINED
class Node:
def __init__(self):
self.left_child = None
self.right_c... | ivy/ivy/functional/frontends/sklearn/tree/_tree.py/0 | {
"file_path": "ivy/ivy/functional/frontends/sklearn/tree/_tree.py",
"repo_id": "ivy",
"token_count": 5357
} | 35 |
import ivy
import ivy.functional.frontends.tensorflow as tf_frontend
from ivy.functional.frontends.tensorflow.func_wrapper import to_ivy_arrays_and_back
from ivy import with_supported_dtypes
ACTIVATION_FUNCTIONS = [
"gelu",
"leaky_relu",
"log_softmax",
"relu",
"sigmoid",
"silu",
"softmax",... | ivy/ivy/functional/frontends/tensorflow/keras/activations.py/0 | {
"file_path": "ivy/ivy/functional/frontends/tensorflow/keras/activations.py",
"repo_id": "ivy",
"token_count": 2187
} | 36 |
import ivy
from ivy.functional.frontends.tensorflow.func_wrapper import (
to_ivy_arrays_and_back,
handle_tf_dtype,
)
from ivy.func_wrapper import with_supported_dtypes
# dct
@to_ivy_arrays_and_back
def dct(input, type=2, n=None, axis=-1, norm=None, name=None):
return ivy.dct(input, type=type, n=n, axis=ax... | ivy/ivy/functional/frontends/tensorflow/signal.py/0 | {
"file_path": "ivy/ivy/functional/frontends/tensorflow/signal.py",
"repo_id": "ivy",
"token_count": 868
} | 37 |
from . import functional
from . import modules
from .modules import *
from . import parameter
from .parameter import Parameter
| ivy/ivy/functional/frontends/torch/nn/__init__.py/0 | {
"file_path": "ivy/ivy/functional/frontends/torch/nn/__init__.py",
"repo_id": "ivy",
"token_count": 29
} | 38 |
# global
import ivy
from ivy.func_wrapper import (
with_unsupported_dtypes,
with_supported_dtypes,
)
import ivy.functional.frontends.torch as torch_frontend
from ivy.functional.frontends.torch.func_wrapper import (
to_ivy_arrays_and_back,
)
erfc = torch_frontend.special.erfc
@to_ivy_arrays_and_back
def ... | ivy/ivy/functional/frontends/torch/pointwise_ops.py/0 | {
"file_path": "ivy/ivy/functional/frontends/torch/pointwise_ops.py",
"repo_id": "ivy",
"token_count": 7460
} | 39 |
import ivy
def coordinate_delta(sum_grad, sum_hess, w, reg_alpha, reg_lambda):
mask = ivy.where(sum_hess < 1e-5, 0.0, 1.0)
sum_grad_l2 = sum_grad + reg_lambda * w
sum_hess_l2 = sum_hess + reg_lambda
tmp = w - sum_grad_l2 / sum_hess_l2
return ivy.where(
tmp >= 0,
ivy.fmax(-(sum_gra... | ivy/ivy/functional/frontends/xgboost/linear/coordinate_common.py/0 | {
"file_path": "ivy/ivy/functional/frontends/xgboost/linear/coordinate_common.py",
"repo_id": "ivy",
"token_count": 515
} | 40 |
# global
from typing import Union, Tuple, Optional
# local
import ivy
from ivy.func_wrapper import (
handle_array_function,
to_native_arrays_and_back,
handle_out_argument,
handle_nestable,
handle_array_like_without_promotion,
handle_device,
handle_backend_invalid,
)
from ivy.utils.exception... | ivy/ivy/functional/ivy/set.py/0 | {
"file_path": "ivy/ivy/functional/ivy/set.py",
"repo_id": "ivy",
"token_count": 6665
} | 41 |
import ivy
import sys
from importlib.util import resolve_name, module_from_spec
from ivy.utils.backend import ast_helpers
import_cache = {}
path_hooks = []
# Note that any modules listed as 'to skip' should not depend on the Ivy backend state.
# If they do, the behavior of ivy.with_backend is undefined and may not f... | ivy/ivy/utils/_importlib.py/0 | {
"file_path": "ivy/ivy/utils/_importlib.py",
"repo_id": "ivy",
"token_count": 1861
} | 42 |
import os
import sys
import glob
import importlib
dir_path = os.path.dirname(os.path.realpath(__file__))
so_files = glob.glob(dir_path + "/*.so")
sys.path.append(dir_path)
__all__ = []
for so_file in so_files:
# if os.path.basename(so_file) != "add.so":
# continue
module_name = os.path.splitext(os.pa... | ivy/ivy/wrappers/__init__.py/0 | {
"file_path": "ivy/ivy/wrappers/__init__.py",
"repo_id": "ivy",
"token_count": 296
} | 43 |
from . import general_helpers
from .general_helpers import *
from . import array_helpers
from .array_helpers import *
from . import dtype_helpers
from .dtype_helpers import *
from . import number_helpers
from .number_helpers import *
| ivy/ivy_tests/test_ivy/helpers/hypothesis_helpers/__init__.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/helpers/hypothesis_helpers/__init__.py",
"repo_id": "ivy",
"token_count": 70
} | 44 |
from .base import FrontendConfigWithBackend
def get_config():
return PaddleFrontendConfig()
class PaddleFrontendConfig(FrontendConfigWithBackend):
backend_str = "paddle"
| ivy/ivy_tests/test_ivy/test_frontends/config/paddle.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/config/paddle.py",
"repo_id": "ivy",
"token_count": 57
} | 45 |
# global
from hypothesis import strategies as st, assume
import numpy as np
import ivy
# 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_core.test_linalg import (
_get_first_matrix_and_dtype,
_get_second... | ivy/ivy_tests/test_ivy/test_frontends/test_jax/test_numpy/test_mathematical_functions.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_jax/test_numpy/test_mathematical_functions.py",
"repo_id": "ivy",
"token_count": 40460
} | 46 |
# Testing Function
# global
from hypothesis import strategies as st
# 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_experiment... | ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_indexing_routines/test_indexing_like_operations.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_indexing_routines/test_indexing_like_operations.py",
"repo_id": "ivy",
"token_count": 2742
} | 47 |
# global
from hypothesis import strategies as st, assume
import ivy
# 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
# all
@handle_frontend_test(
fn_tree="numpy.all",... | ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_logic/test_truth_value_testing.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_logic/test_truth_value_testing.py",
"repo_id": "ivy",
"token_count": 3124
} | 48 |
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 _dtype_x_bounded_axis(draw, **kwargs):
dtype, x, shape = draw(helpers.dtype_and_values(**kwargs, ret... | ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_manipulation_routines/test_rearranging_elements.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_manipulation_routines/test_rearranging_elements.py",
"repo_id": "ivy",
"token_count": 2906
} | 49 |
# 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
# arccos
@handle_frontend_test(
fn_tree="numpy.arccos",
dtypes_values_casting=np_frontend_helpers.dtypes_values_ca... | ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_mathematical_functions/test_trigonometric_functions.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_mathematical_functions/test_trigonometric_functions.py",
"repo_id": "ivy",
"token_count": 6453
} | 50 |
# 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
# bincount
@handle_frontend_test(
fn_tree="numpy.bincount",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("int... | ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_statistics/test_histograms.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_numpy/test_statistics/test_histograms.py",
"repo_id": "ivy",
"token_count": 542
} | 51 |
# global
from hypothesis import strategies as st, assume
import hypothesis.extra.numpy as nph
import numpy as np
import sys
# 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_frontends.test_torch.test_blas_and_lapack_ops import ... | ivy/ivy_tests/test_ivy/test_frontends/test_paddle/test_math.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_paddle/test_math.py",
"repo_id": "ivy",
"token_count": 30734
} | 52 |
# TODO: uncomment after frontend is not required
# global
import sys
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_frontend_test, BackendHandler
# --- Helpers --- #
# --------------- #
@st.composite
def ... | ivy/ivy_tests/test_ivy/test_frontends/test_scipy/test_linalg/test_linalg.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_scipy/test_linalg/test_linalg.py",
"repo_id": "ivy",
"token_count": 6302
} | 53 |
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="sklearn.utils.as_float_array",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("valid"),
),
... | ivy/ivy_tests/test_ivy/test_frontends/test_sklearn/test_utils/test_validation.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_sklearn/test_utils/test_validation.py",
"repo_id": "ivy",
"token_count": 711
} | 54 |
# import torch
from ivy_tests.test_ivy.test_frontends import NativeClass
torch_classes_to_ivy_classes = {}
def convtorch(argument):
"""Convert NativeClass in argument to ivy frontend counterpart for
torch."""
if isinstance(argument, NativeClass):
return torch_classes_to_ivy_classes.get(argument.... | ivy/ivy_tests/test_ivy/test_frontends/test_torch/__init__.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_torch/__init__.py",
"repo_id": "ivy",
"token_count": 119
} | 55 |
# global
from hypothesis import assume, strategies as st
import numpy as np
# local
import ivy
from ivy.functional.ivy.layers import _get_embed_dim, _pack_padded_sequence
from ivy_tests.test_ivy import helpers
from ivy_tests.test_ivy.helpers import handle_frontend_test
from ivy_tests.test_ivy.test_functional.test_nn.t... | ivy/ivy_tests/test_ivy/test_frontends/test_torch/test_nn/test_functional/test_layer_functions.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_frontends/test_torch/test_nn/test_functional/test_layer_functions.py",
"repo_id": "ivy",
"token_count": 4410
} | 56 |
"""Collection of tests for unified meta functions."""
# global
import pytest
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_test
from ivy_tests.test_ivy.helpers.pipeline_helper import BackendHandler
# foma... | ivy/ivy_tests/test_ivy/test_functional/test_core/test_meta.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_functional/test_core/test_meta.py",
"repo_id": "ivy",
"token_count": 25578
} | 57 |
# global
from hypothesis import strategies as st, assume
import hypothesis.extra.numpy as nph
import numpy as np
# local
import ivy
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers.hypothesis_helpers.general_helpers import sizes_
from ivy_tests.test_ivy.helpers import handle_test, create_co... | ivy/ivy_tests/test_ivy/test_functional/test_experimental/test_core/test_manipulation.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_functional/test_experimental/test_core/test_manipulation.py",
"repo_id": "ivy",
"token_count": 22804
} | 58 |
import ivy
import numpy as np
import pytest
@pytest.mark.parametrize(
("shape1", "shape2", "shape3"),
[
(
(2, 4, 3),
(3, 5, 2),
(2, 6, 2),
)
],
)
def test_tr_to_tensor(shape1, shape2, shape3):
# Create ground truth TR factors
factors = [
... | ivy/ivy_tests/test_ivy/test_misc/test_factorized_tensor/test_tr_tensor.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_misc/test_factorized_tensor/test_tr_tensor.py",
"repo_id": "ivy",
"token_count": 1335
} | 59 |
"""Collection of tests for Ivy modules."""
# global
import os
from hypothesis import given, strategies as st
import numpy as np
# local
import ivy
from ivy.functional.ivy.gradients import _variable
import ivy_tests.test_ivy.helpers as helpers
class TrainableModule(ivy.Module):
def __init__(
self,
... | ivy/ivy_tests/test_ivy/test_stateful/test_modules.py/0 | {
"file_path": "ivy/ivy_tests/test_ivy/test_stateful/test_modules.py",
"repo_id": "ivy",
"token_count": 9779
} | 60 |
import os
import sys
import subprocess
from pydriller import Repository
from tqdm import tqdm
import bz2
import _pickle as cPickle
def main():
BACKENDS = ["numpy", "jax", "tensorflow", "torch"]
N = 4
run_iter = int(sys.argv[1]) - 1
test_names = []
func_folder = "ivy_tests/array_api_testing/array_... | ivy/scripts/determine_tests/array_api_det_coverage.py/0 | {
"file_path": "ivy/scripts/determine_tests/array_api_det_coverage.py",
"repo_id": "ivy",
"token_count": 2549
} | 61 |
# Run Tests
import os
import sys
if __name__ == "__main__":
failed = False
with open(sys.argv[1], "w") as f_write:
with open("tests_to_run", "r") as f:
for line in f:
test_path, backend = line.strip().split(",")
print(f"\n{'*' * 100}")
print(... | ivy/scripts/run_tests/run_tests_pr.py/0 | {
"file_path": "ivy/scripts/run_tests/run_tests_pr.py",
"repo_id": "ivy",
"token_count": 457
} | 62 |
#!/bin/bash -e
docker run --rm -it -v "$(pwd)":/ivy unifyai/ivy:latest python3 -m pytest ivy_tests/
| ivy/scripts/shell/run_tests.sh/0 | {
"file_path": "ivy/scripts/shell/run_tests.sh",
"repo_id": "ivy",
"token_count": 45
} | 63 |
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.236.0/containers/docker-existing-dockerfile
{
"name": "Ivy Development Environment (build)",
"build": {
"dockerfile": "../../docker/Dockerfile",
"conte... | ivy/.devcontainer/build/devcontainer.json/0 | {
"file_path": "ivy/.devcontainer/build/devcontainer.json",
"repo_id": "ivy",
"token_count": 765
} | 0 |
<component name="ProjectRunConfigurationManager">
<configuration default="true" type="tests" factoryName="py.test">
<module name="ivy" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
<env name="PY... | ivy/.idea/runConfigurations/_template__of_py_test.xml/0 | {
"file_path": "ivy/.idea/runConfigurations/_template__of_py_test.xml",
"repo_id": "ivy",
"token_count": 937
} | 1 |
FROM debian:buster
WORKDIR /ivy
ARG CLI
# python version for conda
ARG pycon=3.10
ENV DEBIAN_FRONTEND=noninteractive
# Install miniconda
ENV CONDA_DIR /opt/miniconda/
RUN apt clean && \
rm -rf /var/lib/apt/lists/* && \
apt-get update && \
apt-get install -y wget \
git -y && \
wget --quiet https:... | ivy/docker/Dockerfile/0 | {
"file_path": "ivy/docker/Dockerfile",
"repo_id": "ivy",
"token_count": 1282
} | 2 |
{% extends "top_level_module.rst" %}
{%- block options -%}
{{super()}} :private-members:
{%- endblock -%}
.. Experimental modules are added here
{% block custom_content %}
{% for submodule in modules %}
.. automodule:: {{submodule}}
:members:
:special-members: __init__
:undoc-members:
:private-... | ivy/docs/_templates/data_module.rst/0 | {
"file_path": "ivy/docs/_templates/data_module.rst",
"repo_id": "ivy",
"token_count": 139
} | 3 |
The Basics
==========
.. _`repo`: https://github.com/unifyai/ivy
.. _`discord`: https://discord.gg/sXyFF8tDtm
.. _`todo list issues thread`: https://discord.com/channels/799879767196958751/1189903501011202128
.. _`Atlassian tutorial`: https://www.atlassian.com/git/tutorials/saving-changes/git-stash
.. _`fork managemen... | ivy/docs/overview/contributing/the_basics.rst/0 | {
"file_path": "ivy/docs/overview/contributing/the_basics.rst",
"repo_id": "ivy",
"token_count": 9574
} | 4 |
Function Arguments
==================
.. _`Array API Standard`: https://data-apis.org/array-api/latest/
.. _`spec/API_specification/signatures`: https://github.com/data-apis/array-api/tree/main/spec/2022.12/API_specification
.. _`repo`: https://github.com/unifyai/ivy
.. _`discord`: https://discord.gg/sXyFF8tDtm
.. _`f... | ivy/docs/overview/deep_dive/function_arguments.rst/0 | {
"file_path": "ivy/docs/overview/deep_dive/function_arguments.rst",
"repo_id": "ivy",
"token_count": 3598
} | 5 |
Ivy Container
=============
Here, we explain how the :class:`ivy.Container` class saves you a ton of time and cleans up code in almost all aspects of your ML workflow.
So without further ado, let’s dive in!
Firstly, Dictionaries are an incredibly powerful and useful data type in Python.
They enable a clean, readable,... | ivy/docs/overview/design/ivy_as_a_framework/ivy_container.rst/0 | {
"file_path": "ivy/docs/overview/design/ivy_as_a_framework/ivy_container.rst",
"repo_id": "ivy",
"token_count": 9709
} | 6 |
.. _`RWorks API Standards`:
API Standards
=============
.. _`Array API Standard`: https://data-apis.org/array-api/latest/
.. _`discord`: https://discord.gg/sXyFF8tDtm
API standards are standardized application programming interfaces (APIs) which define the function signatures which similar libraries should adhere to... | ivy/docs/overview/related_work/api_standards.rst/0 | {
"file_path": "ivy/docs/overview/related_work/api_standards.rst",
"repo_id": "ivy",
"token_count": 336
} | 7 |
__version__ = "0.0.7.2"
| ivy/ivy/_version.py/0 | {
"file_path": "ivy/ivy/_version.py",
"repo_id": "ivy",
"token_count": 14
} | 8 |
# global
import abc
from typing import Optional, Union
# local
import ivy
class _ArrayWithCreationExperimental(abc.ABC):
def eye_like(
self: ivy.Array,
/,
*,
k: int = 0,
dtype: Optional[Union[ivy.Dtype, ivy.NativeDtype]] = None,
device: Optional[Union[ivy.Device, i... | ivy/ivy/data_classes/array/experimental/creation.py/0 | {
"file_path": "ivy/ivy/data_classes/array/experimental/creation.py",
"repo_id": "ivy",
"token_count": 5458
} | 9 |
# global
import abc
from typing import Optional, Union, Tuple, Sequence
# local
import ivy
class _ArrayWithStatisticalExperimental(abc.ABC):
def histogram(
self: ivy.Array,
/,
*,
bins: Optional[Union[int, ivy.Array, ivy.NativeArray, str]] = None,
axis: Optional[Union[ivy.A... | ivy/ivy/data_classes/array/experimental/statistical.py/0 | {
"file_path": "ivy/ivy/data_classes/array/experimental/statistical.py",
"repo_id": "ivy",
"token_count": 12911
} | 10 |
# local
import ivy
# global
from typing import Callable, Type, List, Iterable
from types import ModuleType
TO_IGNORE = ["shape"]
def _wrap_function(function_name: str) -> Callable:
"""Wrap the function called `function_name`.
Parameters
----------
function_name
the name of the function e.g.... | ivy/ivy/data_classes/array/wrapping.py/0 | {
"file_path": "ivy/ivy/data_classes/array/wrapping.py",
"repo_id": "ivy",
"token_count": 1492
} | 11 |
# global
from typing import Optional, Union, List, Dict, Tuple, Sequence
from numbers import Number
# local
import ivy
from ivy.data_classes.container.base import ContainerBase
class _ContainerWithElementWiseExperimental(ContainerBase):
@staticmethod
def static_amax(
x: ivy.Container,
/,
... | ivy/ivy/data_classes/container/experimental/elementwise.py/0 | {
"file_path": "ivy/ivy/data_classes/container/experimental/elementwise.py",
"repo_id": "ivy",
"token_count": 62764
} | 12 |
from typing import Optional, Union, List, Dict
# local
import ivy
from ivy.data_classes.container.base import ContainerBase
# noinspection PyMissingConstructor
class _ContainerWithGradients(ContainerBase):
@staticmethod
def _static_stop_gradient(
x: Union[ivy.Container, ivy.Array, ivy.NativeArray],
... | ivy/ivy/data_classes/container/gradients.py/0 | {
"file_path": "ivy/ivy/data_classes/container/gradients.py",
"repo_id": "ivy",
"token_count": 14193
} | 13 |
# local
from .base import FactorizedTensor
import ivy
class CPTensor(FactorizedTensor):
def __init__(self, cp_tensor):
super().__init__()
shape, rank = ivy.CPTensor.validate_cp_tensor(cp_tensor)
weights, factors = cp_tensor
if weights is None:
weights = ivy.ones(rank,... | ivy/ivy/data_classes/factorized_tensor/cp_tensor.py/0 | {
"file_path": "ivy/ivy/data_classes/factorized_tensor/cp_tensor.py",
"repo_id": "ivy",
"token_count": 12594
} | 14 |
use super::{
ArrayElement, ArrayShape, ElementType, FromPrimitive, NativeType, PrimitiveType, Shape,
};
use crate::{c_lib, Error, Result};
use pyo3::prelude::*;
/// A literal represent a value, typically a multi-dimensional array, stored on the host device.
#[derive(Debug)]
#[pyclass(unsendable)]
pub struct Litera... | ivy/ivy/engines/XLA/rust_api/src/wrappers/literal.rs/0 | {
"file_path": "ivy/ivy/engines/XLA/rust_api/src/wrappers/literal.rs",
"repo_id": "ivy",
"token_count": 4705
} | 15 |
# global
import sys
from packaging import version
import jaxlib
import jax
import jax.numpy as jnp
import importlib
from typing import Union
# make ivy.Container compatible with jax pytree traversal
from jax.tree_util import register_pytree_node
from jax.tree_util import tree_flatten, tree_unflatten
# local
import iv... | ivy/ivy/functional/backends/jax/__init__.py/0 | {
"file_path": "ivy/ivy/functional/backends/jax/__init__.py",
"repo_id": "ivy",
"token_count": 2788
} | 16 |
# global
from typing import Optional, Union, Tuple, List, Literal, Sequence, Callable
import jax
import jax.lax as jlax
import jax.numpy as jnp
import math
# local
import ivy
from ivy import output_to_native_arrays
from ivy.functional.backends.jax import JaxArray
from ivy.functional.backends.jax.random import RNG
from... | ivy/ivy/functional/backends/jax/experimental/layers.py/0 | {
"file_path": "ivy/ivy/functional/backends/jax/experimental/layers.py",
"repo_id": "ivy",
"token_count": 15384
} | 17 |
# global
import math
from numbers import Number
from typing import Union, Tuple, Optional, List, Sequence, Iterable
import jax.numpy as jnp
import numpy as np
# local
import ivy
from ivy.func_wrapper import with_unsupported_dtypes
from ivy.functional.backends.jax import JaxArray
from . import backend_version
def _fl... | ivy/ivy/functional/backends/jax/manipulation.py/0 | {
"file_path": "ivy/ivy/functional/backends/jax/manipulation.py",
"repo_id": "ivy",
"token_count": 3348
} | 18 |
import mxnet as mx
backend_version = {"version": mx.__version__}
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 *
from .manipulation import *
f... | ivy/ivy/functional/backends/mxnet/experimental/__init__.py/0 | {
"file_path": "ivy/ivy/functional/backends/mxnet/experimental/__init__.py",
"repo_id": "ivy",
"token_count": 152
} | 19 |
from ivy.utils.exceptions import IvyNotImplementedException
def is_native_sparse_array(x):
raise IvyNotImplementedException()
def native_sparse_array(
data=None,
*,
coo_indices=None,
crow_indices=None,
col_indices=None,
ccol_indices=None,
row_indices=None,
values=None,
dense_... | ivy/ivy/functional/backends/mxnet/experimental/sparse_array.py/0 | {
"file_path": "ivy/ivy/functional/backends/mxnet/experimental/sparse_array.py",
"repo_id": "ivy",
"token_count": 237
} | 20 |
# global
import sys
import numpy as np
# local
import ivy
from ivy.func_wrapper import _dtype_from_version
backend_version = {"version": np.__version__}
# noinspection PyUnresolvedReferences
if not ivy.is_local():
_module_in_memory = sys.modules[__name__]
else:
_module_in_memory = sys.modules[ivy.import_modu... | ivy/ivy/functional/backends/numpy/__init__.py/0 | {
"file_path": "ivy/ivy/functional/backends/numpy/__init__.py",
"repo_id": "ivy",
"token_count": 2591
} | 21 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.