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 and video tutorials to do so 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.10.tar.gz (15.8 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.10-cp312-cp312-win_amd64.whl (11.0 MB view details)

Uploaded CPython 3.12Windows x86-64

ivy-0.0.9.10-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.10-cp312-cp312-macosx_12_0_arm64.whl (16.3 MB view details)

Uploaded CPython 3.12macOS 12.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

ivy-0.0.9.10-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.10-cp311-cp311-macosx_12_0_arm64.whl (16.4 MB view details)

Uploaded CPython 3.11macOS 12.0+ ARM64

ivy-0.0.9.10-cp310-cp310-win_amd64.whl (9.8 MB view details)

Uploaded CPython 3.10Windows x86-64

ivy-0.0.9.10-cp310-cp310-manylinux_2_17_x86_64.whl (9.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

ivy-0.0.9.10-cp310-cp310-macosx_12_0_arm64.whl (16.3 MB view details)

Uploaded CPython 3.10macOS 12.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

ivy-0.0.9.10-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.10-cp38-cp38-win_amd64.whl (9.8 MB view details)

Uploaded CPython 3.8Windows x86-64

ivy-0.0.9.10-cp38-cp38-manylinux_2_17_x86_64.whl (9.8 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

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

File metadata

  • Download URL: ivy-0.0.9.10.tar.gz
  • Upload date:
  • Size: 15.8 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.10.tar.gz
Algorithm Hash digest
SHA256 9999801ff392bceb163a32a5a9dbc840ea8f4932142be35edd0ba8fdc60fb031
MD5 1581f4476183895307c0ce42c9d76888
BLAKE2b-256 902237fc5b85c4a0b951dc211281c049b5a7286f1a0887ac1fbb3398e2a89b80

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ivy-0.0.9.10-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.10-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1c35024e0d3cf7ea2cae6ed59262233f52fb32296a50cb7bb1f5b85bfe490f3b
MD5 09af28bd11016150d1f878e5cfdab083
BLAKE2b-256 9344154ac59a064a0d236dd0d2642cc11c5d552b4b31ef1b4c7c9ac8900a3f7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-0.0.9.10-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 d10553a2d087a0b4fc3bc852b89c78e2a68dcafd831cc2f696aa54198085e509
MD5 9900db61a5d1e7e194ea15340e798e45
BLAKE2b-256 9d54574e1384e2b6ec2eef0b157886cc364228e4b4d866de1196e602c5cc5efb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-0.0.9.10-cp312-cp312-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 2ec6f76197eded283afa61539d8061f530958c5711722f817a8debd7909a159e
MD5 52e6199fe48b1de0e7f97ed4d3234cbd
BLAKE2b-256 cf8da6ac7af1bdf663efcd1cb6ad66916678aeee4aa62dc6642890350b02cd02

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ivy-0.0.9.10-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.10-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c92682b5995b930e41b4b071d6a6daaecdd62b5eb12275378b2b31fc74b112f5
MD5 13c50ce461955b29ee4a76075f2af8dc
BLAKE2b-256 7180da17cd752c7edf90b42c808ab24af77001132e735dd3c738222b4e7934e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-0.0.9.10-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 3759bbfa8539f8e6abce6de5532e754ede3b24885e3cbed5185dd550faf044be
MD5 bf1d494c7b3fa47e1b334110cb0381bf
BLAKE2b-256 5ae14c5aa876bd6d743ebfb940571ff287b0119e64374ad6d71f30a4a73c6101

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-0.0.9.10-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 8c8a5ee6abb994244f00abe7fc1b4a14960fa034f3df79b7868ce43b35c39f59
MD5 a0b65db8632f88a627df02e52538aae8
BLAKE2b-256 7ff52572ef15be4dc4ab28816b04f12715ec2b95781a7c901ec5f334ebd1b344

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ivy-0.0.9.10-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 9.8 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.10-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3d84ae81dd0055b52f92d13efe6a2dddb0905e2d18d23f74b6bceaa5241a30fd
MD5 02e9e15301c816a39aecb61c094886b1
BLAKE2b-256 5a1f6603b7984d36396c0bd4af9cbbfecc0a7dbd1b6be4fba704a211ae41c9bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-0.0.9.10-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 31913a6b7079ca5e16e7c9fdd89c65efb74d3ec3b7c31e634c5cd78b0a441d03
MD5 915c11d882a8ad07aee4dcc4ceb8c16a
BLAKE2b-256 af1c27ab16578128786d375dc5c64929715961cbca6c48270b3097ea150492de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-0.0.9.10-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 b54d99ed677b607d24507c414a9645a5c954ed00b5b3e71c59b8d4493f2136e0
MD5 fc2d1903784ae134589e9df03620fd68
BLAKE2b-256 8d27fad94791d362e240cbaef29ea0741ea0db0dd5420382d997eb675af77485

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ivy-0.0.9.10-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.10-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 026070c6574b3335e523b3c00441f3954e9ec194d51ad30fb6f08b577a0ac430
MD5 39a321f4902d4680b60c9a39e814c42f
BLAKE2b-256 ce86eae68adc9ddd2d38851523287b8a21dad5f5221d49a7d8a0a8cc26b944e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-0.0.9.10-cp39-cp39-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 37b315c4d48d6d3af5bbb2a948948cb84afaa7401e0a8ba5685b993b4e3c19d9
MD5 fc495f161613ab90472460c894881d5b
BLAKE2b-256 d580289f1e6f2c73bc2c0751cfc94878704a6348577eaf1757de3a5063ab613d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ivy-0.0.9.10-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 9.8 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.10-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 c467ab65c08ab44dd5c4b8c52a5281b48ce9e204739f9606e291eac25ffd2f60
MD5 f7ef0be01012d5ab2fbac7da01fba142
BLAKE2b-256 9c921de958947f32707774baa3a77e058462a67910852f6f464beb81c65c207a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-0.0.9.10-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 1c00da995764450713aa9af8428a6d2762500285617477a437186ddca2bc7301
MD5 52aae3c6442dee07845975073120aa6e
BLAKE2b-256 1fc9aca38d0afeb2a2b130947dc184ee6fcde5df0273dbcb6713424d534e4e03

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

0.0.9.13

14 files

0.0.9.12

14 files

This release

0.0.9.10 This release

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