Skip to main content

Website
Website
Docs
Docs
Demos
Demos
Design
Design
FAQ
FAQ


Convert Machine Learning Code Between Frameworks

Ivy enables you to:

  • Convert ML models, tools and libraries between frameworks while maintaining complete functionality using ivy.transpile
  • Create optimized graph-based models and functions in any native framework (PyTorch, TensorFlow, etc..) with ivy.trace_graph

Installing ivy

The easiest way to set up Ivy is to install it using pip:

pip install ivy
Docker Image

You can pull the Docker image for Ivy from:

docker pull ivyllc/ivy:latest
From Source

You can also install Ivy from source if you want to take advantage of the latest changes, but we can't ensure everything will work as expected 😅

git clone https://github.com/ivy-llc/ivy.git
cd ivy
pip install --user -e .

If you want to set up testing and various frameworks it's probably best to check out the Setting Up page, where OS-specific and IDE-specific instructions are available!


Supported Frameworks

These are the frameworks that ivy.transpile currently supports conversions from and to. We're working hard on adding support for more frameworks, let us know on Discord if there are source/target frameworks that would be useful for you!

Framework Source Target
PyTorch 🚧
TensorFlow 🚧
JAX 🚧
NumPy 🚧

Getting started

Ivy's transpiler allows you convert code between different ML frameworks. Have a look at our Quickstart notebook to get a brief idea of the features!

Beyond that, based on the frameworks you want to convert code between, there are a few more examples further down this page 👇 which contain a number of models and libraries transpiled between PyTorch, JAX, TensorFlow and NumPy.


Using ivy

Here's some examples, to help you get started using Ivy! The examples page also features a wide range of demos and tutorials showcasing some more use cases for Ivy.

Transpiling any code from one framework to another
import ivy
import torch
import tensorflow as tf

def torch_fn(x):
    a = torch.mul(x, x)
    b = torch.mean(x)
    return x * a + b

tf_fn = ivy.transpile(torch_fn, source="torch", target="tensorflow")

tf_x = tf.convert_to_tensor([1., 2., 3.])
ret = tf_fn(tf_x)
Tracing a computational graph of any code
import ivy
import torch

def torch_fn(x):
    a = torch.mul(x, x)
    b = torch.mean(x)
    return x * a + b

torch_x = torch.tensor([1., 2., 3.])
graph = ivy.trace_graph(jax_fn, to="torch", args=(torch_x,))
ret = graph(torch_x)

How ivy works?

Let's take a look at how Ivy works as a transpiler in more detail to get an idea of why and where to use it.

When is Ivy's transpiler useful?

If you want to use building blocks published in other frameworks (neural networks, layers, array computing libraries, training pipelines...), you want to integrate code developed in various frameworks, or maybe straight up migrate code from one framework to another or even between versions of the same framework, the transpiler is definitely the tool for the job! You can use the converted code just as if it was code originally developed in that framework, applying framework-specific optimizations or tools, instantly exposing your project to all of the unique perks of a different framework.


Ivy's transpiler allows you to use code from any other framework (or from any other version of the same framework!) in your own code, by just adding one line of code.

This way, Ivy makes all ML-related projects available for you, independently of the framework you want to use to research, develop, or deploy systems. Feel free to head over to the docs for the full API reference, but the functions you'd most likely want to use are:

# Converts framework-specific code to a target framework of choice. See usage in the documentation
ivy.transpile()

# Traces an efficient fully-functional graph from a function, removing all wrapping and redundant code. See usage in the documentation
ivy.trace_graph()

ivy.transpile will eagerly transpile if a class or function is provided

import ivy
import torch
import tensorflow as tf

def torch_fn(x):
    x = torch.abs(x)
    return torch.sum(x)

x1 = torch.tensor([1., 2.])
x1 = tf.convert_to_tensor([1., 2.])

# Transpilation happens eagerly
tf_fn = ivy.transpile(test_fn, source="torch", target="tensorflow")

# tf_fn is now tensorflow code and runs efficiently
ret = tf_fn(x1)

ivy.transpile will lazily transpile if a module (library) is provided

import kornia

x2 = torch.rand(5, 3, 4, 4)

# Module is provided -> transpilation happens lazily
tf_kornia = ivy.transpile(kornia, source="torch", target="tensorflow")

# The transpilation is initialized here, and this function is converted to tensorflwo
ret = tf_kornia.color.rgb_to_grayscale(x2)

# Transpilation has already occurred, the tensorflow function runs efficiently
ret = tf_kornia.color.rgb_to_grayscale(x2)

ivy.trace_graph can be used eagerly or lazily

If you pass the necessary arguments for function tracing, the graph tracing step will happen instantly (eagerly). Otherwise, the graph tracing will happen only when the returned function is first invoked.

import ivy
import jax
ivy.set_backend("jax")

# Simple JAX function to transpile
def test_fn(x):
    return jax.numpy.sum(x)

x1 = ivy.array([1., 2.])
# Arguments are available -> tracing happens eagerly
eager_graph = ivy.trace_graph(test_fn, to="jax", args=(x1,))

# eager_graph now runs efficiently
ret = eager_graph(x1)
# Arguments are not available -> tracing happens lazily
lazy_graph = ivy.trace_graph(test_fn, to="jax")

# The traced graph is initialized, tracing will happen here
ret = lazy_graph(x1)

# Tracing has already happend, traced graph runs efficiently
ret = lazy_graph(x1)

If you want to learn more, you can find more information in the Ivy as a transpiler section of the docs!


Documentation

You can find Ivy's documentation on the Docs page, which includes:

  • Motivation: This contextualizes the problem Ivy is trying to solve by going over
  • Related Work: Which paints a picture of the role Ivy plays in the ML stack, comparing it to other existing solutions in terms of functionalities and abstraction level.
  • Design: A user-focused guide about the design decision behind the architecture and the main building blocks of Ivy.
  • Deep Dive: Which delves deeper into the implementation details of Ivy and is oriented towards potential contributors to the code base.

Contributing

We believe that everyone can contribute and make a difference. Whether it's writing code, fixing bugs, or simply sharing feedback, your contributions are definitely welcome and appreciated 🙌

Check out all of our Open Tasks, and find out more info in our Contributing guide in the docs! Or to immediately dive into a useful task, look for any failing tests on our Test Dashboard!


Community



Join our growing community on a mission to make conversions between frameworks simple and accessible to all! Whether you are a seasoned developer or just starting out, you'll find a place here! Join the Ivy community on our Discord 👾 server, which is the perfect place to ask questions, share ideas, and get help from both fellow developers and the Ivy Team directly.

See you there!


Citation

If you use Ivy for your work, please don't forget to give proper credit by including the accompanying paper 📄 in your references. It's a small way to show appreciation and help to continue to support this and other open source projects 🙌

@article{lenton2021ivy,
  title={Ivy: Templated deep learning for inter-framework portability},
  author={Lenton, Daniel and Pardo, Fabio and Falck, Fabian and James, Stephen and Clark, Ronald},
  journal={arXiv preprint arXiv:2102.02886},
  year={2021}
}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ivy-0.0.9.13.tar.gz (15.9 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ivy-0.0.9.13-cp312-cp312-win_amd64.whl (11.0 MB view details)

Uploaded CPython 3.12Windows x86-64

ivy-0.0.9.13-cp312-cp312-manylinux_2_17_x86_64.whl (11.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

ivy-0.0.9.13-cp312-cp312-macosx_12_0_arm64.whl (16.4 MB view details)

Uploaded CPython 3.12macOS 12.0+ ARM64

ivy-0.0.9.13-cp311-cp311-win_amd64.whl (9.9 MB view details)

Uploaded CPython 3.11Windows x86-64

ivy-0.0.9.13-cp311-cp311-manylinux_2_17_x86_64.whl (9.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

ivy-0.0.9.13-cp311-cp311-macosx_12_0_arm64.whl (16.4 MB view details)

Uploaded CPython 3.11macOS 12.0+ ARM64

ivy-0.0.9.13-cp310-cp310-win_amd64.whl (9.9 MB view details)

Uploaded CPython 3.10Windows x86-64

ivy-0.0.9.13-cp310-cp310-manylinux_2_17_x86_64.whl (9.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

ivy-0.0.9.13-cp310-cp310-macosx_12_0_arm64.whl (16.4 MB view details)

Uploaded CPython 3.10macOS 12.0+ ARM64

ivy-0.0.9.13-cp39-cp39-win_amd64.whl (9.9 MB view details)

Uploaded CPython 3.9Windows x86-64

ivy-0.0.9.13-cp39-cp39-manylinux_2_17_x86_64.whl (9.9 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

ivy-0.0.9.13-cp38-cp38-win_amd64.whl (9.9 MB view details)

Uploaded CPython 3.8Windows x86-64

ivy-0.0.9.13-cp38-cp38-manylinux_2_17_x86_64.whl (9.9 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file ivy-0.0.9.13.tar.gz.

File metadata

  • Download URL: ivy-0.0.9.13.tar.gz
  • Upload date:
  • Size: 15.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for ivy-0.0.9.13.tar.gz
Algorithm Hash digest
SHA256 5a122a74d716d645c5e73a22ca3234577dc8053421574a5df5329ab4aa8b2add
MD5 a02e2d8cd6f65c71f3ce5040b53d62ef
BLAKE2b-256 d9f367880756ae37c922c3225690cfe53e74cb1520a9229d0c355df669482625

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.13-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: ivy-0.0.9.13-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 11.0 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for ivy-0.0.9.13-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5716546909883b0c5655e47b19c072f6c8793eb81ac209af03e0d00a678be923
MD5 ea6fa53d6e6b1c4636137ba602c0e709
BLAKE2b-256 b700d0d6a2897db51a736a7dc219a80cc955500a66e49ea9aa187ed052c7c85c

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.13-cp312-cp312-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for ivy-0.0.9.13-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 5e65d62230b49f4e83631be04ea0b79183521ebb246dfeaad9549852e074a805
MD5 16b899f1257e57c24e4c4b43432db4e6
BLAKE2b-256 60c3f3a02d2c6132e700473909798f3eef0ebb4b424be90c81ee7fc3befd01eb

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.13-cp312-cp312-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for ivy-0.0.9.13-cp312-cp312-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 ad9f3beea6e6ce090c79103c72e6e6f0996aaa232c4d4b7fd59891062c8ddd31
MD5 c2b70afde99c3ed11f551f1aa5322232
BLAKE2b-256 d7e57a3138cac3b173e8c3382ed53ea71678fdbda789a0aeb535aab3b1eb7176

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.13-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: ivy-0.0.9.13-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 9.9 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for ivy-0.0.9.13-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 74cdba6ab2d86a95bb2543e1a81bb8fb5ea87cfc0f306ae80fd516181f084a6c
MD5 bda296f4fbd2e079dbdfa36a1ceda8b8
BLAKE2b-256 625d7f975637b74af794dfcac0bfaf845182bd2ecae2ad5a010c4e3dfce6f6cf

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.13-cp311-cp311-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for ivy-0.0.9.13-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6d1144e586e72f0ccd17cfceab1d44b3324c27769d20cf2d83ce0929a6141ee3
MD5 37de84b9bbe32d1c704be38ee78c290f
BLAKE2b-256 87b14fc45540bc5339adb1f6e512f5c910f7d7fd7c9844c7356d08ee4ef89c74

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.13-cp311-cp311-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for ivy-0.0.9.13-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 1f69b02327c7bcf81ee6e2acdf9e1c233cf823fe2f5da4b476d983158318649d
MD5 f9b45a43d74bf7f37f9f9f02e39a2214
BLAKE2b-256 3764b2b5a5e43347ea9f7aa592d28044177ccec63eda2cacbf1dff75e251e8ef

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.13-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: ivy-0.0.9.13-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 9.9 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for ivy-0.0.9.13-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 bad48d7c16eb898e786a3a553e53e9e879e5f4a64cb5bc9b705cd9363dd91298
MD5 b7e814b7c203f6efd0aa24ca71dcb7b0
BLAKE2b-256 0e6d67e288e15a3685080f4edf2ebf9d0213df2824dfc821a98cfcf6bf155cbd

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.13-cp310-cp310-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for ivy-0.0.9.13-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 99572674bdb0febbc9fd8fed6d43a1598553d75cce12a1dfa3aebf1cd71bef9b
MD5 3a45d063ee4f5c077d108107afaee2ba
BLAKE2b-256 749f00ea67a5be72779d633c3714efb6405f1ffc840b9aec8239da4e22640b93

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.13-cp310-cp310-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for ivy-0.0.9.13-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 7f031643b2e0dc194422a1b548d0452b655aa3e13e30dcc3301fc9607c6cf2b3
MD5 fc2f8a46f3f5590bebc6140af818c18b
BLAKE2b-256 fdaa10f900b85513c513da933ef091f75c37562d0d0499d3b3748805b59b9629

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.13-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: ivy-0.0.9.13-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 9.9 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for ivy-0.0.9.13-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 5faa54ac055cab6c7ee8fe85d09990a5b7b21cc2dc411fd6385372831192249f
MD5 4d21369b181a6266acfdf47c19b9189b
BLAKE2b-256 8ea34c446e27cf729137f75fbb8a33d5d78dad5f87f9a797dfa2960f97a698f9

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.13-cp39-cp39-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for ivy-0.0.9.13-cp39-cp39-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 28f8fb20922d7a754575f7780fa2d471de370c7052a8b602691225e51a68f7d1
MD5 9a3fcceef756f63368cd49c89ea51046
BLAKE2b-256 91dfff4382411819f8685342a652cf95163a07247a67dbcbf044b3747417f966

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.13-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: ivy-0.0.9.13-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 9.9 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for ivy-0.0.9.13-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 5779c9b4da9f094ca8cccfb086ed055ace73c126745d1b2fbb9a75511fd83756
MD5 43b68edc5f4be5366c1f42394abbfe89
BLAKE2b-256 38672cb92a49a6a108ef449810008d647b2b0e23c02917a3b406c09b4d27bda8

See more details on using hashes here.

File details

Details for the file ivy-0.0.9.13-cp38-cp38-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for ivy-0.0.9.13-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 bc9f9caf8cd8583884ecbdcd55f7aee1a51983d4e7981f05b4797bb580c56f12
MD5 271fb7872cec11528f4bbac624224ca6
BLAKE2b-256 d234ec34deea629538fcbcf8adba4fdd9584e92cc12f9679d4f9690526769f97

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.0.5

2 files

1.0.0.4

2 files

1.0.0.3

2 files

1.0.0.2

2 files

1.0.0.1

17 files

1.0.0.0

17 files

0.0.9.17

17 files

0.0.9.16

17 files

0.0.9.15

17 files

0.0.9.14

17 files

This release

0.0.9.13 This release

14 files

0.0.9.12

14 files

0.0.9.10

14 files

0.0.9.9

14 files

0.0.9.8

14 files

0.0.9.7

11 files

0.0.9.6

11 files

0.0.9.5

11 files

0.0.9.4

11 files

0.0.9.3

11 files

0.0.9.2

11 files

0.0.9.1

11 files

0.0.9.0

11 files

0.0.8.0

11 files

0.0.7.5

11 files

0.0.7.4

11 files

0.0.7.3

11 files

0.0.7.2

11 files

0.0.7.1

11 files

0.0.7.0

11 files

0.0.6.2

7 files

0.0.6.1

7 files

0.0.6.0

7 files

0.0.5.1

7 files

0.0.5.0

7 files

0.0.4.0

2 files

0.0.3.0

2 files

0.0.2.0

2 files

0.0.1.0

2 files

0.0.0

4 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page