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-1.0.0.0.tar.gz (22.5 MB view details)

Uploaded Source

Built Distributions

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

ivy-1.0.0.0-cp313-cp313-win_amd64.whl (17.9 MB view details)

Uploaded CPython 3.13Windows x86-64

ivy-1.0.0.0-cp313-cp313-manylinux_2_17_x86_64.whl (18.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

ivy-1.0.0.0-cp313-cp313-macosx_12_0_arm64.whl (23.0 MB view details)

Uploaded CPython 3.13macOS 12.0+ ARM64

ivy-1.0.0.0-cp312-cp312-win_amd64.whl (18.1 MB view details)

Uploaded CPython 3.12Windows x86-64

ivy-1.0.0.0-cp312-cp312-manylinux_2_17_x86_64.whl (18.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

ivy-1.0.0.0-cp312-cp312-macosx_12_0_arm64.whl (23.5 MB view details)

Uploaded CPython 3.12macOS 12.0+ ARM64

ivy-1.0.0.0-cp311-cp311-win_amd64.whl (17.2 MB view details)

Uploaded CPython 3.11Windows x86-64

ivy-1.0.0.0-cp311-cp311-manylinux_2_17_x86_64.whl (17.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

ivy-1.0.0.0-cp311-cp311-macosx_12_0_arm64.whl (23.8 MB view details)

Uploaded CPython 3.11macOS 12.0+ ARM64

ivy-1.0.0.0-cp310-cp310-win_amd64.whl (17.2 MB view details)

Uploaded CPython 3.10Windows x86-64

ivy-1.0.0.0-cp310-cp310-manylinux_2_17_x86_64.whl (18.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

ivy-1.0.0.0-cp310-cp310-macosx_12_0_arm64.whl (23.8 MB view details)

Uploaded CPython 3.10macOS 12.0+ ARM64

ivy-1.0.0.0-cp39-cp39-win_amd64.whl (18.0 MB view details)

Uploaded CPython 3.9Windows x86-64

ivy-1.0.0.0-cp39-cp39-manylinux_2_17_x86_64.whl (18.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

ivy-1.0.0.0-cp38-cp38-win_amd64.whl (18.1 MB view details)

Uploaded CPython 3.8Windows x86-64

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

File metadata

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

File hashes

Hashes for ivy-1.0.0.0.tar.gz
Algorithm Hash digest
SHA256 e7ee4ed0b2ee7e540880cafa0547e08f54b4529b37e50e14545d3d5914c3fdd6
MD5 f26fccf4fb18e51a600a899ea6633a23
BLAKE2b-256 126f70733e9af75fceca93fca0a934825ec7c29de86d6f56f8f47a2435bd8731

See more details on using hashes here.

File details

Details for the file ivy-1.0.0.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: ivy-1.0.0.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 17.9 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for ivy-1.0.0.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 cf2f23ed90830ee03711171ea0cdbb63fa06c3e5fc3b92e2a5f7182404db092d
MD5 7461d4294357fe020d5da42d070150e4
BLAKE2b-256 960da5648c459d94510ae981af17d87f2d86c274d60423e31ecf2b98dfd01e52

See more details on using hashes here.

File details

Details for the file ivy-1.0.0.0-cp313-cp313-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for ivy-1.0.0.0-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 b3e791893767e2493d07b26cfc34837eece9ef17f3fe4b079746742b1419c082
MD5 36bd702d358d00663b7894b41f5fc68b
BLAKE2b-256 38a5cf34652ac08c38b29d86219d4bedf56287cde59a213cfee57f62e73f2e35

See more details on using hashes here.

File details

Details for the file ivy-1.0.0.0-cp313-cp313-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for ivy-1.0.0.0-cp313-cp313-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 02066a00ae1d71675612e11af69327e8e1f0b342d4e07198fbd08abc28a1266f
MD5 a0ed3685fa450097837a0bf0a94e3d96
BLAKE2b-256 44d2761ab4808b6433663d6b6f85be04dea0e9e82f164a84c8b5bd8b75079d42

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ivy-1.0.0.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 18.1 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-1.0.0.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 451b11a2db9059029d773482daa2e3cd64f0d8e528a38aa9c35998f88028c6d5
MD5 6be4521e3da3fa9a9bd509a2d93273a0
BLAKE2b-256 a119e24083029a310627a0db87c9a19a5aa1309a54865ed409c467b6a9a768ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-1.0.0.0-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 8c3f60d50aabd6002044d1084264441b1afa40e0e68c1cdb98627d18c5441827
MD5 ae8eb783e6af90d52dfa310f5ddddc97
BLAKE2b-256 06bff12dea0d603737a36cd915153309946d3fe769202d0e6254fd41687c827a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-1.0.0.0-cp312-cp312-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 2aab706a9f7ff6e917f48816d59b4d3328799b7ade82888eed3bb2dfa527ea52
MD5 ac26ff658f89a7a37b60e500b461a42e
BLAKE2b-256 a1a4c15118ef6efc9d078a8fcfe5a31a7c5a1a42ecb4578c0f9ceaf4a8e646bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ivy-1.0.0.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 17.2 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-1.0.0.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 cb3fedfd5b45aba3be45a903bcde4f7ce874678ff525dffc7ebd44d766d8dec3
MD5 a6e897d9468c344685f831fdcc2dc89f
BLAKE2b-256 cd16f0f05618101de6744480222f672e40cbcbcee6f47fc5b910cc4b0418a8e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-1.0.0.0-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 9a780a4e398425e89a6549c48abb883e24dcd5a1389580c9fa1c54b66b914fc4
MD5 9d4cb115defce742c3fbfac138c335d3
BLAKE2b-256 13c8a4662e069e741d543e42263d6f33756c3fd59d3aa962e2787bebdf919d49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-1.0.0.0-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 13ac28063e6d8754c835a0e8ed6b51914dc13d0be7d53e6e4a55658e9c71805a
MD5 61f62e966debc29b503b28d0bbd6dae1
BLAKE2b-256 5787a81b581608a8a35f0441734afc654f72f009409af1decb726ffd1be1b7f4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ivy-1.0.0.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 17.2 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-1.0.0.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 85f615996a95a8577ed1d4f99ebe53e580f2a3c6ef8e1eeb8c4a2f12ad9ef078
MD5 ec9c5fb5f7a1c39869d5ddcea8bcae10
BLAKE2b-256 3a14030bd25bdc6af03e9f9b425f98ce5861282a226b24b4bc508552f30f58d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-1.0.0.0-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6df6951f598bef4d6fef5297fd30476f6cfebd050d11d109e366f34dd27ce16c
MD5 606dd8f185d6991fc2d94d50aa0a0419
BLAKE2b-256 4763a931366f1d5cfae98b96987dc9bf9f908202eb36799292094537b4f76e95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-1.0.0.0-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 f08944b4b93c4c50144c98a2fa1aed596fb892291eb556dbbb8468274ab11ea3
MD5 bd8f68e6f24dcecff6500f90bab09e12
BLAKE2b-256 fa5c9edba3c885f5a6940607bf732986c22ffdb58256e937741205929e9f7b6d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ivy-1.0.0.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 18.0 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-1.0.0.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ace5ad879ed982112c202c41cb65bb89482bc4539a4cb1cc4348d66cd1c4605e
MD5 eed185d020958b08c90179953c96f579
BLAKE2b-256 8a7c18f516825f8e2a62a3774aee8d21fb922abae4fe0b22b3a417fcab7b70ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-1.0.0.0-cp39-cp39-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 7f9662ac7b4be47386199f274f35409ea9c986ecffb22e92762c8e09ba08054d
MD5 a444adfeb5d9030319b1f4af5f20d128
BLAKE2b-256 6c747d80e8f344a7210c99610a2ccde8f1b91dc5afdbe8609e2901fc44cc4b3c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ivy-1.0.0.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 18.1 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-1.0.0.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 3bfd63d7abf5b78e1046f6ce2aa8d9652d57088267c0008175ae0066dac99e88
MD5 9ee352ff019322cd53d8f2977264a728
BLAKE2b-256 20bdea55e4e2574a6a869d174d620c52e7f6d9ed0c048440e4c298ab1593f79d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ivy-1.0.0.0-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 11fc29a1a8d6c12ccce1826591f8d594c3e7ec58174b45c58bfb30d12f1508a6
MD5 e1d6a610fda6e9b205cbb3711c50c89b
BLAKE2b-256 2e4e96635b2c4e592048ebe2f9dcd896ab3fe75f83990fdd3738aa1af2eab5ca

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

This release

1.0.0.0 This release

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

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