Ivy
Convert Machine Learning Code Between Frameworks
Install / Use
/learn @ivy-llc/IvyREADME
Convert Machine Learning Code Between Frameworks
Ivy enables you to convert ML models, tools and libraries between frameworks using ivy.transpile
Installation
The easiest way to install Ivy is using pip:
pip install ivy
<details>
<summary><b>From Source</b></summary>
<br clear="all" />
You can also install Ivy from source if you want to take advantage of the latest changes:
git clone https://github.com/ivy-llc/ivy.git
cd ivy
pip install --user -e .
</details>
<br clear="all" />
Supported Frameworks
These are the frameworks that ivy.transpile currently supports conversions from and to.
| Framework | Source | Target | |------------|:------:|:------:| | PyTorch | ✅ | 🚧 | | TensorFlow | 🚧 | ✅ | | JAX | 🚧 | ✅ | | NumPy | 🚧 | ✅ |
<br clear="all" />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.
<details> <summary><b>Transpiling any code from one framework to another</b></summary> <br clear="all" />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)
</details>
<details>
<summary><b>Tracing a computational graph of any code</b></summary>
<br clear="all" />
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)
</details>
<details>
<summary><b>How does ivy work?</b></summary>
<br clear="all" />
Ivy's transpiler allows you to use code from any other framework in your own code. 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 ivy
import kornia
import tensorflow as tf
x2 = tf.random.normal((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 tensorflow
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)
</details>
<br clear="all" />
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.
<br clear="all" /> <a href="https://github.com/ivy-llc/ivy/graphs/contributors"> <img class="dark-light" src="https://contrib.rocks/image?repo=ivy-llc/ivy&anon=0&columns=20&max=100&r=true" /> </a> <br clear="all" /> <br clear="all" />Citation
@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}
}
Related Skills
claude-opus-4-5-migration
99.2kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
model-usage
344.4kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
TrendRadar
50.5k⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。
mcp-for-beginners
15.7kThis open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.
