### Install Ivy from Source Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/get_started.rst Installs Ivy from its source code repository. This is recommended for accessing the latest changes and for development purposes. It includes steps for cloning the repository, installing the package, and installing development dependencies. ```bash git clone https://github.com/ivy-llc/ivy.git cd ivy pip install --user -e . pip install -r requirements/requirements.txt pip install -r requirements/optional.txt ``` -------------------------------- ### TensorFlow Profiling Setup Source: https://github.com/ivy-llc/ivy/blob/main/ivy/utils/profiler_example.ipynb Configures and starts TensorFlow profiling using Ivy's utility functions. Logs are saved to the specified directory. ```python logs = 'logs/' + "tensorflow" from ivy.utils.profiler import tensorflow_profile_start, tensorflow_profile_stop tensorflow_profile_start(logs, host_tracer_level = 3, python_tracer_level = 1, device_tracer_level = 1) tf_model(x) tensorflow_profile_stop() ``` -------------------------------- ### PyTorch Profiling Setup Source: https://github.com/ivy-llc/ivy/blob/main/ivy/utils/profiler_example.ipynb Initializes, starts, and stops PyTorch profiling using Ivy's utility functions. Configures activities, trace handlers, and memory profiling. ```python from ivy.utils.profiler import torch_profiler_init, torch_profiler_start, torch_profiler_stop profiler = torch_profiler_init(activities=[torch.profiler.ProfilerActivity.CPU, torch.profiler.ProfilerActivity.CUDA ], on_trace_ready=torch.profiler.tensorboard_trace_handler('./logs/torch'), record_shapes=True, profile_memory=True, with_stack=True) torch_profiler_start(profiler) torch_model(x2) torch_profiler_stop(profiler) ``` -------------------------------- ### Install Ivy using pip Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/get_started.rst Installs the Ivy library using pip. This method installs only the core NumPy framework and does not include other frameworks like PyTorch or TensorFlow. ```bash pip install ivy ``` -------------------------------- ### VS Code Dev Containers Setup (Windows) Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Steps to set up a development environment using Visual Studio Code and Docker on Windows. This includes installing Docker Desktop, VS Code, and the necessary extensions. ```bash # 1. Install Docker Desktop. # 2. Install Visual Studio Code. # 3. Ensure Docker Desktop is running. # 4. Open the Ivy repo folder in VS Code. # 5. Install 'Dev Containers' and 'Docker' extensions. # 6. Restart VS Code. # 7. Click the bottom-left icon (><). # 8. Select 'Open Folder in Container...' # 9. Run tests using 'pytest test_file_path::test_fn_name' inside the container. ``` -------------------------------- ### VS Code Dev Containers Setup (Ubuntu) Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Instructions for setting up a development environment on Ubuntu using Visual Studio Code and Docker. This involves installing Docker Engine, VS Code, and configuring the dev container. ```bash # 1. Install Docker Engine. # 2. Install Visual Studio Code. # 3. Clone the Ivy repository. # 4. Open the Ivy repo folder in VS Code. # 5. Install 'Dev Containers' and 'Docker' extensions. # 6. Open '.devcontainer/devcontainer.json'. # 7. Modify 'postCreateCommand': add a comma after the existing command. # 8. Add 'postStartCommand': "git config --global --add safe.directory ${containerWorkspaceFolder}" # 9. Click the remote explorer icon (><) in the bottom left. ``` -------------------------------- ### Installing Ivy from GitHub Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Installs the Ivy package directly from its GitHub repository using pip. ```bash pip install git+https://github.com/unifyai/ivy.git ``` -------------------------------- ### Pull Ivy Docker Image Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/get_started.rst Pulls the latest pre-built Docker image for Ivy. This image includes all supported frameworks and relevant packages, providing a convenient environment for using Ivy. ```bash docker pull ivyllc/ivy:latest ``` -------------------------------- ### Install Docker on Ubuntu Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Commands to install Docker CE, CLI, containerd.io, and docker-compose-plugin on Ubuntu systems. This includes updating package lists, installing prerequisites, adding the Docker repository, and installing the Docker packages. ```none sudo apt-get update sudo apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin ``` -------------------------------- ### Install Optional Dependencies (Linux/Windows/Intel Mac) Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Installs optional development dependencies using the 'optional.txt' requirements file. ```bash pip install -r requirements/optional.txt ``` -------------------------------- ### Install Optional Apple Silicon Dependencies Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Installs optional dependencies for Apple Silicon compatibility using pip. ```none pip install -r requirements/optional_apple_silicon_2.txt ``` -------------------------------- ### Installing Ivy Development Dependencies Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Installs the required development dependencies for the Ivy project from the 'requirements.txt' and 'optional.txt' files. ```bash pip install -r requirements/requirements.txt pip install -r requirements/optional.txt ``` -------------------------------- ### Install Ivy from Source Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Installs the latest version of Ivy directly from its GitHub repository. This is useful for developers who want to use the most recent changes, but it may not guarantee stability. ```none pip install git+https://github.com/unifyai/ivy.git ``` -------------------------------- ### Install Optional Dependencies (M1 Mac) Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Installs optional development dependencies for M1 Macs using specific requirements files. ```bash pip install -r requirements/optional_apple_silicon_1.txt pip install -r requirements/optional_apple_silicon_2.txt ``` -------------------------------- ### Troubleshooting PaddlePaddle Installation on Ubuntu 22.04 Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Provides commands to manually install a specific version of libssl1.1, which may be required for PaddlePaddle to install correctly on Ubuntu 22.04. ```bash wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb ``` -------------------------------- ### Install Ivy using pip Source: https://github.com/ivy-llc/ivy/blob/main/README.md This command installs the Ivy library using pip, the standard package installer for Python. Ensure you have Python and pip installed on your system. ```bash pip install ivy ``` -------------------------------- ### Install Array API Testing Dependencies Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Installs dependencies required for running tests in the Array API suite after navigating to the correct directory. ```bash pip install -r requirements.txt ``` -------------------------------- ### Container Operator Examples Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/docstring_examples.rst Describes how to document operator examples for ivy.Container instances, such as 'x + y' where 'x' is an ivy.Container, referencing ivy.Container.____. ```python x + y ``` -------------------------------- ### Install Optional Dependencies (venv - Linux/Windows/Intel Mac) Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Installs optional development dependencies using the 'optional.txt' requirements file for venv environments. ```bash pip install -r requirements/optional.txt ``` -------------------------------- ### Install Ivy from Source Source: https://github.com/ivy-llc/ivy/blob/main/README.md This section provides instructions for installing Ivy directly from its source code repository on GitHub. This method is useful for developers who want to use the latest unreleased features or contribute to the project. It involves cloning the repository, navigating into the directory, and then performing an editable installation. ```bash git clone https://github.com/ivy-llc/ivy.git cd ivy pip install --user -e . ``` -------------------------------- ### Install Optional Dependencies (venv - M1 Mac) Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Installs optional development dependencies for M1 Macs using specific requirements files within a venv environment. ```bash pip install -r requirements/optional_apple_silicon_1.txt ``` -------------------------------- ### Install and Configure Pre-Commit Hooks Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Provides instructions for installing the pre-commit package and setting up its hooks within the cloned Ivy repository. This ensures code quality checks are performed before commits. ```python python3 -m pip install pre-commit ``` ```bash pre-commit install ``` -------------------------------- ### Install and Run Pre-commit Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/formatting.rst Instructions for installing the pre-commit tool and running all configured checks manually. Pre-commit automates code formatting and linting before commits. ```bash pip install pre-commit pre-commit install pre-commit run --all-files ``` -------------------------------- ### Graph Construction Example Source: https://github.com/ivy-llc/ivy/blob/main/ivy/tracer/README.md Provides a simplified example of how graph construction works by showing a function and explaining the backward traversal process from output to input to build the computational graph. ```python def example_function(x): y = ivy.mean(x) # Node 1 z = ivy.sqrt(y) # Node 2 return z # Graph construction starts from z, links to sqrt node, # then to mean node, and finally to input x ``` -------------------------------- ### Ivy Backend Handling Example Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/design/building_blocks.rst Illustrates how Ivy sets and manages backend frameworks, including updating the global dictionary with backend-specific methods. This example shows the logic for dynamically integrating backend functionalities. ```python # ivy/utils/backend/handler.py def set_backend(backend: str): # un-modified ivy.__dict__ global ivy_original_dict if not backend_stack: ivy_original_dict = ivy.__dict__.copy() # add the input backend to the global stack backend_stack.append(backend) # iterate through original ivy.__dict__ for k, v in ivy_original_dict.items(): # if method doesn't exist in the backend if k not in backend.__dict__: # add the original ivy method to backend backend.__dict__[k] = v # update global ivy.__dict__ with this method ivy.__dict__[k] = backend.__dict__[k] ``` -------------------------------- ### Install Array API Testing Dependencies Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Installs packages required for running tests in the Array API suite. This command should be run from the 'ivy/ivy_tests/array_api_testing/test_array_api' directory within your cloned Ivy repository. ```none pip install -r requirements.txt ``` -------------------------------- ### Installing Python Virtual Environment Package Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Installs the Python virtual environment package 'venv' using apt, a package manager for Debian-based Linux distributions. ```bash sudo apt install python3-venv ``` -------------------------------- ### Container Instance Method Examples Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/docstring_examples.rst Illustrates documenting instance method calls on an ivy.Container instance, like 'x.func_name(...)' where 'x' is an ivy.Container. ```python x.func_name(...) ``` -------------------------------- ### ivy.Container.add Instance Method Example Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/docstring_examples.rst Demonstrates calling the add functionality as an instance method on an ivy.Container object. ```python x = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([2, 3, 4])) # Further operations would follow here, e.g., adding another container or array ``` -------------------------------- ### Array Instance Method Examples Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/docstring_examples.rst Shows how to document instance method calls on an ivy.Array instance, such as 'x.func_name(...)' where 'x' is an ivy.Array. ```python x.func_name(...) ``` -------------------------------- ### Install and Configure Pre-commit Hooks Source: https://github.com/ivy-llc/ivy/wiki/Team-Members Installs the pre-commit package and configures it to run linting and formatting checks before each commit. This helps catch formatting errors early in the development process. ```bash pip install pre-commit pre-commit install ``` -------------------------------- ### Number of Examples Configuration Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/the_basics.rst Sets the maximum number of examples to be generated by Hypothesis. Accepts any positive integer greater than 1. ```text Set the maximum number of examples to be generated by Hypothesis. The value of this flag could be any positive integer value that is greater than 1. Default value is :code:`5`. ``` -------------------------------- ### Launch TensorBoard for TensorFlow Profiling Source: https://github.com/ivy-llc/ivy/blob/main/ivy/utils/profiler_example.ipynb Launches TensorBoard to visualize TensorFlow profiling data. Users should navigate to the 'Profile' tab. ```bash # Launch TensorBoard and navigate to the Profile tab to view performance profile !tensorboard --logdir='logs/' ``` -------------------------------- ### Printing Hypothesis Examples Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/ivy_tests.rst Demonstrates how to print examples generated by Hypothesis for a given function and number of examples. This is useful for understanding the data generation process. ```python >>> print_hypothesis_examples(dtype_and_values(), 2) (['int8'], [array(69, dtype=int8)]) (['int8'], [array([-23, -81], dtype=int8)]) ``` -------------------------------- ### Container Instance Method Examples Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/docstring_examples.rst Shows how to invoke instance methods on an ivy.Container object. These examples are meant for the docstrings of the corresponding ivy.Container instance methods. ```python # Assuming 'x' is an ivy.Container instance # Example: x.func_name(...) ``` -------------------------------- ### Array Instance Method Examples Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/docstring_examples.rst Illustrates how to call instance methods on an ivy.Array object. These examples are intended for the docstrings of the respective ivy.Array instance methods. ```python # Assuming 'x' is an ivy.Array instance # Example: x.func_name(...) ``` -------------------------------- ### Fetch Ivy Binaries Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst This snippet demonstrates how to fetch necessary binaries for the Ivy project using the `cleanup_and_fetch_binaries` utility function. This is useful if system binaries are missing or outdated. ```python import ivy ivy.utils.cleanup_and_fetch_binaries() ``` -------------------------------- ### Printing Hypothesis Examples Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/ivy_tests.rst A template function to print examples generated by Hypothesis search strategies. It takes a search strategy and an optional number of examples to print. ```python import hypothesis.strategies as st def print_hypothesis_examples(st: st.SearchStrategy, n = 3): for i in range(n): print(st.example()) ``` -------------------------------- ### Container Operator Examples Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/docstring_examples.rst Shows operator usage with ivy.Container instances. Examples include operations between two containers with Numbers or Arrays at the leaves, and between a Container and an Array. ```python # Assuming 'x' and 'y' are ivy.Container instances with Number leaves # Example: x + y ``` ```python # Assuming 'x' and 'y' are ivy.Container instances with ivy.Array leaves # Example: x + y ``` ```python # Assuming 'x' is an ivy.Container instance and 'y' is an ivy.Array instance # Example: x + y ``` -------------------------------- ### Array Operator Examples Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/docstring_examples.rst Explains how to document operator examples for ivy.Array instances, such as 'x + y' where 'x' is an ivy.Array, linking to the corresponding special methods like ivy.Array.__add__. ```python x + y ``` -------------------------------- ### Example Function Argument Specification Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/docstring_examples.rst An example of a function's argument specification, highlighting type hints for arguments like 'mode' which can accept a Union of specific types. ```python def my_func(x: array, mode: Union[std, prod, var], ``` -------------------------------- ### Docstring Example Best Practices Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/docstring_examples.rst Docstring examples should not include code that imports the 'ivy' library or sets a backend, as this can lead to segmentation faults. Follow these guidelines for correct formatting. ```text .. note:: Docstring examples should not have code that imports ivy or sets a backend, otherwise it leads to segmentation faults. ``` -------------------------------- ### Clone Ivy Repository Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Demonstrates how to clone the Ivy repository from GitHub using different methods, including recursive submodule cloning and the GitHub CLI. It also shows how to add the original repository as an upstream remote for synchronization. ```none git clone --recurse-submodules git@github.com:YOUR_USERNAME/ivy.git ``` ```none git clone --recurse-submodules https://github.com/YOUR_USERNAME/ivy.git ``` ```none gh repo clone YOUR_USERNAME/ivy your_folder -- --recurse-submodules ``` ```bash git remote add upstream https://github.com/unifyai/ivy.git ``` -------------------------------- ### PyTorch Unsupported Dtype Error Example Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/fix_failing_tests.rst An example of a `RuntimeError` in PyTorch when an unsupported dtype ('Half') is passed to a function. It includes the falsifying example and a suggestion for a solution using `with_unsupported_dtypes` decorator. ```python E RuntimeError: "logaddexp2_cpu" not implemented for 'Half' E Falsifying example: test_logaddexp2( E backend_fw='torch', E on_device='cpu', E dtype_and_x=(['float16', 'float16'], E [array([-1.], dtype=float16), array([-1.], dtype=float16)]), E test_flags=FunctionTestFlags( E ground_truth_backend='tensorflow', E num_positional_args=2, E with_out=False, E instance_method=False, E test_gradients=False, E test_trace=None, E as_variable=[False], E native_arrays=[False], E container=[False], E ), E fn_name='logaddexp2', E ) E E You can reproduce this example by temporarily adding @reproduce_failure('6.82.4', b'AXicY2BkAAMoBaaR2WAAAACVAAY=') as a decorator on your test case ``` -------------------------------- ### JAX Transpose Assertion Error Example Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/fix_failing_tests.rst An example of an assertion error in `test_jax_transpose` due to shape mismatches between the ground truth and the target backend (Paddle). It includes the falsifying example and a hint for reproduction. ```python E ivy.utils.exceptions.IvyBackendException: paddle: to_numpy: paddle: default_device: paddle: dev: (PreconditionNotMet) Tensor not initialized yet when DenseTensor::place() is called. E [Hint: holder_ should not be null.] (at /paddle/paddle/phi/core/dense_tensor_impl.cc:61) E E Falsifying example: test_jax_transpose( E on_device='cpu', E frontend='jax', E backend_fw='paddle', E array_and_axes=(array([], shape=(1, 0), dtype=complex64), E ['complex64'], E None), E test_flags=FrontendFunctionTestFlags( E num_positional_args=0, E with_out=False, E inplace=False, E as_variable=[False], E native_arrays=[False], E test_trace=False, E generate_frontend_arrays=False, E transpile=False, E precision_mode=True, E ), E fn_tree='ivy.functional.frontends.jax.numpy.transpose', E ) E E You can reproduce this example by temporarily adding @reproduce_failure('6.87.3', b'AAEGBAEGAQAAAAAAAAAAAAAB') as a decorator on your test case ``` -------------------------------- ### Build Ivy Docs using Convenience Script Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/building_the_docs.rst This snippet shows how to navigate to the docs directory and execute the convenience script to build the Ivy documentation. The output is stored in 'docs/build'. ```bash cd docs ./make_docs.sh ``` -------------------------------- ### Container Reverse Operator Examples Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/docstring_examples.rst Explains documenting reverse operator examples for ivy.Container instances, where a Number operates on an ivy.Container (e.g., 'x + y' with 'x' as Number and 'y' as ivy.Container), referencing ivy.Container.__r__. ```python x + y ``` -------------------------------- ### Array Reverse Operator Examples Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/docstring_examples.rst Details documenting reverse operator examples for ivy.Array instances, where a Number operates on an ivy.Array (e.g., 'x + y' with 'x' as Number and 'y' as ivy.Array), referencing ivy.Array.__r__. ```python x + y ``` -------------------------------- ### Functional Examples with ivy.Array Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/docstring_examples.rst Demonstrates how to add functional examples to docstrings for functions called with ivy.Array instances. It covers variations in arguments, input shapes, and the usage of the 'out' parameter, including broadcasting scenarios. ```python ivy.func_name(...) ``` -------------------------------- ### Nestable Function Examples with Ivy Container Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/docstring_examples.rst Demonstrates passing ivy.Container instances as arguments to nestable functions. Examples include passing a single container or multiple containers, ensuring each container has at least two leaves. ```python x = ivy.Container(a=ivy.array([0.]), b=ivy.array([1.])) # Example usage with a nestable function: # result = ivy_module.some_nestable_function(x, ...) ``` ```python x = ivy.Container(a=ivy.array([0.]), b=ivy.array([1.])) y = ivy.Container(c=ivy.array([2.]), d=ivy.array([3.])) # Example usage with multiple container arguments: # result = ivy_module.some_nestable_function(x, y, ...) ``` -------------------------------- ### Hypothesis Test with @example Decorator Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/ivy_tests.rst Demonstrates how to use the `@example` decorator from the Hypothesis library to re-run a specific failing test case. This is useful for efficiently debugging issues by ensuring a particular falsifying example is always tested. ```python import hypothesis from hypothesis import example @example( dtype_and_x=(['bfloat16', 'int16'], [-0.9090909090909091, -1]), as_variable=False, num_positional_args=2, native_array=False, container=False, instance_method=False, fw='torch', ) def test_result_type(dtype_and_x, as_variable, num_positional_args, native_array, container, instance_method, fw): # Test implementation here pass ``` -------------------------------- ### Ivy Codespace Development Environments Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Lists the available Dev container configurations for setting up the Ivy development environment in GitHub Codespaces. Each option specifies whether it's for CPU or GPU, and if it builds from a Dockerfile or uses a pre-built image. ```markdown - :code:`Default project configuration` - This is the default option, it will set up with the default codespaces environment. - :code:`Ivy Development Environment (build)` - This will set up the development environment of ivy for CPU and build image from :code:`ivy/docker/Dockerfile`. - :code:`Ivy GPU Development Environment (build)` - This will set up the development environment of ivy for GPU and build image from :code:`ivy/docker/DockerfileGPU`. - :code:`Ivv Development Environment for Multiver...` - This will set up the development environment of multiversion support with ivy and build image from :code:`ivy/docker/DockerfileMultiversion`. - :code:`Ivy Development Environment (image)` - This will set up the development environment of ivy for CPU and build image from the latest image from dockerhub. - :code:`Ivy GPU Development Environment (image)` - This will set up the development environment of ivy for GPU and build image from the latest image from dockerhub. ``` -------------------------------- ### ivy.tan Functional Examples Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/docstring_examples.rst Demonstrates the usage of the `ivy.tan` function with `ivy.Array` inputs. It covers variations in input shape, values, and the use of the `out` argument for in-place operations. The examples adhere to docstring testing conventions, including multi-line input formatting. ```python >>> x = ivy.array([0, 1, 2]) >>> y = ivy.tan(x) >>> print(y) ivy.array([0., 1.5574077, -2.1850398]) ``` ```python >>> x = ivy.array([0.5, -0.7, 2.4]) >>> y = ivy.zeros(3) >>> ivy.tan(x, out=y) >>> print(y) ivy.array([0.5463025, -0.8422884, -0.91601413]) ``` ```python >>> x = ivy.array([[1.1, 2.2, 3.3], ... [-4.4, -5.5, -6.6]]) >>> ivy.tan(x, out=x) >>> print(x) ivy.array([[ 1.9647598, -1.3738229, 0.1597457], [-3.0963247, 0.9955841, -0.3278579]]) ``` -------------------------------- ### Running Ivy NN Tests Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Demonstrates how to execute Ivy Neural Network tests with different backends (NumPy, PyTorch, JAX, TensorFlow). The first argument specifies the backend to use. ```python python scripts/setup_tests/run_ivy_nn_test.py 1 ``` -------------------------------- ### Activating a Python Virtual Environment Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Activates the previously created Python virtual environment ('ivy_dev') by sourcing its activation script. ```bash source ivy_dev/bin/activate ``` -------------------------------- ### Ivy Submodule Initialization Example Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/navigating_the_code.rst Demonstrates the typical structure of an __init__.py file within Ivy's functional subfolders. It shows how functions and submodules are imported to make them accessible from the main ivy namespace. ```python from . import elementwise from .elementwise import * from . import general from .general import * # etc. ``` -------------------------------- ### Missing Binaries Warning Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst This snippet represents a potential warning message that might be displayed when importing 'ivy' if any required binaries are missing for the current system configuration. ```none A warning that gets thrown when you :code:`import ivy` if any binaries are missing of the form, ``` -------------------------------- ### ivy.Array.add Instance Method Example Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/docstring_examples.rst Demonstrates calling the add functionality as an instance method on an ivy.Array object. ```python x = ivy.array([1, 2, 3]) y = ivy.array([4, 5, 6]) z = x.add(y) print(z) ``` -------------------------------- ### Install Ivy in Editable Mode (venv) Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Installs the Ivy package in editable mode within the active venv environment. ```bash pip install -e . ``` -------------------------------- ### Opening VSCode from Terminal Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Opens Visual Studio Code in the current directory, allowing for development within the configured environment. ```bash code . ``` -------------------------------- ### Install Ivy in Editable Mode (Miniconda) Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Installs the Ivy package in editable mode within the active conda environment. ```bash pip install -e . ``` -------------------------------- ### Ivy Docstring Examples Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive.rst Explains how to add useful and illustrative examples to Ivy docstrings, enhancing their value for users and developers. ```python pass # Placeholder for docstring examples example ``` -------------------------------- ### Navigating to Ivy Repository Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Changes the current directory to the root of the local Ivy repository. ```bash cd ivy/ ``` -------------------------------- ### Docstring Modification Example (Nestable Explanation) Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/deep_dive/docstrings.rst Provides an example of adding an explanation for nestable functions, which accept Container instances. ```diff +Both the description and the type hints above assumes an array input for simplicity, +but this function is *nestable*, and therefore also accepts :class:`ivy.Container` +instances in place of any of the arguments. ``` -------------------------------- ### Frontend Function Implementation Guide Source: https://github.com/ivy-llc/ivy/wiki/Team-Members Details the steps and considerations for implementing frontend functions across different frameworks. This includes adhering to native arguments and behavior, implementing hypothesis tests, ensuring unit tests pass, and notes on docstrings and type hints. ```APIDOC Frontend Function Implementation: 1. Implement according to native arguments and behavior. 2. Implement hypothesis test. 3. Get unit test passing. 4. Docstrings and type hints are not required. ``` -------------------------------- ### Activate Miniconda Environment Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Activates the 'ivy_dev' conda environment. ```none conda activate ivy_dev ``` -------------------------------- ### Creating a Python Virtual Environment Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Creates a new Python virtual environment named 'ivy_dev' using the 'venv' module. ```bash python3 -m venv ivy_dev ``` -------------------------------- ### Running All Tests in a File with PyCharm Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Explains the process of executing all tests contained within a specific Python file (e.g., `test_elementwise.py`) using PyCharm. This is achieved through a right-click context menu on the file's tab. ```python # test_elementwise.py import ivy def test_addition(): assert ivy.add(2, 3) == 5 def test_subtraction(): assert ivy.subtract(5, 2) == 3 ``` -------------------------------- ### Available Ivy Test Scripts Source: https://github.com/ivy-llc/ivy/blob/main/docs/overview/contributing/setting_up.rst Lists the available shell scripts located in the `ivy/scripts` directory for running various test categories within the Ivy project. This includes scripts for core, NN, stateful, and general testing, as well as dependency checks. ```bash scripts/setup_tests/run_ivy_core_test.py scripts/setup_tests/run_ivy_nn_test.py scripts/setup_tests/run_ivy_stateful_test.py scripts/shell/run_tests.sh scripts/shell/test_array_api.sh scripts/test_dependencies.py scripts/shell/test_dependencies.sh scripts/shell/test_ivy_core.sh scripts/shell/test_ivy_nn.sh scripts/shell/test_ivy_stateful.sh ```