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.12.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.12-cp312-cp312-win_amd64.whl (11.0 MB view details)

Uploaded CPython 3.12Windows x86-64

ivy-0.0.9.12-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.12-cp312-cp312-macosx_12_0_arm64.whl (16.4 MB view details)

Uploaded CPython 3.12macOS 12.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 12.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

ivy-0.0.9.12-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.12-cp310-cp310-macosx_12_0_arm64.whl (16.4 MB view details)

Uploaded CPython 3.10macOS 12.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

ivy-0.0.9.12-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.12-cp38-cp38-win_amd64.whl (9.9 MB view details)

Uploaded CPython 3.8Windows x86-64

ivy-0.0.9.12-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.12.tar.gz.

File metadata

  • Download URL: ivy-0.0.9.12.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.12.tar.gz
Algorithm Hash digest
SHA256 d6135857a7e519d764e6bd64a8065b841b016226d9e3b805e077f564bba177d5
MD5 a1e5b3ce32d6d24f08ea2a2b14fa6ca1
BLAKE2b-256 b0a6089d06c306fb7bbf4d68f4e9d3c913313752268717e832fa303d739932cd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ivy-0.0.9.12-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.12-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9f57a9219e70e8a295db9acf42ebefb5a3529a3fe66ac445d078c1c28a9999cc
MD5 fe5abbe37e8bd8e6f6879df96e365f1c
BLAKE2b-256 51fe0e8d0a1e63b5e675c3e71bd3db22e7eaa708c88562b1199feeae1a135621

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-0.0.9.12-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 2fc576e69cd31ab4f3c7eee2a2e600a573ce912f172e0c16f58da3a159b9dbf4
MD5 482d622466b1422ccfbb456f9fa026a2
BLAKE2b-256 4f08b81ca728b0280e9be69e0b8aeb41d66f5451c4f1eef6929bd4ea608b3ada

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-0.0.9.12-cp312-cp312-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 3b2cb3e26b0818e723fa63c55f64c116a17e4b1486fbed8c00d21cd3394fe250
MD5 1c53172c29e1e155ef02579967f33c71
BLAKE2b-256 c0f4085c51b7005a6de364b3ee772f7d90093ffe4cd4e5855c358f045c97a286

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ivy-0.0.9.12-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.12-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d57e1b62fde18a89e257889f99b734d79e0a87cdf6f417d93ed2161f1dfcca7c
MD5 c861ab5797f83e3df5dacaa883865514
BLAKE2b-256 b00dd20cf4f21fd2b988fe7883d2f584868e8c016a00b9fcc1d7c9e88946800a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-0.0.9.12-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 57b12a8bf68ac6b53c625fbee3dd30201e96c7ecfda4de624db253741216deab
MD5 08b81d661d9ecc8128f081f808c487ed
BLAKE2b-256 0fafdca4033463136e564e0c4542b0fadd5a9ca5710f2d8c8c3fd647178fc43a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-0.0.9.12-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 0701015d51bacaa2e7fe1d275d1a3ffb7ab4bebb8d7b8926f287144f51570c79
MD5 b0b11c7b65c9a2a4fd2455c62a8a8a83
BLAKE2b-256 da1be9e3e915043a9d78fc1e5f3f14243b7dcc6c68d09f90a9331f0c2b484170

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ivy-0.0.9.12-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.12-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e7340a0ab4bff4edf54d18e79924e51cb623fdb8d51599cc769b870e20a12fb7
MD5 f7a29df9d9fae25b788e6c43a3291454
BLAKE2b-256 9e11b53853066d8f2bc553d25c9f87264870c1b8da86d6bbd140167b008ec05e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-0.0.9.12-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 146dfced9211b0c81145b4c5179754502c98f703aef541a462e8904572f39352
MD5 bb49fb5de28d3c6066c46ccfc428cbc6
BLAKE2b-256 f5ff955d6ac0c57e8bf6fcb0bc20b863c86e1d508c6367d49dcccddab93652a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-0.0.9.12-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 eb89de8ca8aac96d4063a1b3f498a8b1c3590be20ea707c51078ff2b5328d360
MD5 a4d25e41bb10187adf6bfb8aba396d01
BLAKE2b-256 f26ec1308fcaef3bcbb453c3752dfc9658df57c2877c4a9ea624acba70b2a962

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ivy-0.0.9.12-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.12-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 eaa7dcbdfcc813e59c5dabdf3abd1edc9a1f4176023c90b67def1581e133615c
MD5 7fe812b990404225e137bc92ed12fe1b
BLAKE2b-256 f6931bba86526a2f918d8e87bd25893af46a1e5554e52f4ccf94e1e987d6eca2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-0.0.9.12-cp39-cp39-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 dd0132e93ccc5f26962f1e9351f7a8a51cb15f53423b0eb25ec259441a5766c1
MD5 93bdc4e453693164b9f1d18878ec8a6a
BLAKE2b-256 0e2ecd2e7bf40fd329b3d891df4b6d1955abf6ca5f6698342edd64188fd32496

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ivy-0.0.9.12-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.12-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 683caef9f90faca8eca45e9e76bda00d43775e9c9f083cf54d377f53a8ca8943
MD5 9446617db63da1c2e58bab4851b75650
BLAKE2b-256 984a3f94365f6ec32bad928a473aa33e7f0964d65748d38ac1a942768a3e7f97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-0.0.9.12-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 c881ecf6129eef6931f312b74c5df71461aa33cf26e1939113fc645bacfc6891
MD5 3851ea225c778d31f5d2205433bfe5ad
BLAKE2b-256 7f95f366511c7b7c1f4fdbd652e8954fe659c8bd3b07ea72805f713e16189fd8

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

This release

0.0.9.12 This release

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