Skip to content

Commit

Permalink
Update compiler.py 8a734de (#28778)
Browse files Browse the repository at this point in the history
Co-authored-by: ivy-dev-bot <hello@transpile-ai.com>
  • Loading branch information
Sam-Armstrong and ivy-dev-bot committed Jun 24, 2024
1 parent d33939d commit 6ce43b0
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 0 deletions.
67 changes: 67 additions & 0 deletions binaries.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,21 @@
"DX",
"I",
"IC",
"ICC",
"ICD",
"ICI",
"ICL",
"ICM",
"ICV",
"ICX",
"ID",
"IDC",
"IDD",
"IDI",
"IDL",
"IDM",
"IDV",
"IDX",
"II",
"IIC",
"IID",
Expand All @@ -32,10 +46,37 @@
"IIV",
"IIX",
"IL",
"ILC",
"ILD",
"ILI",
"ILL",
"ILM",
"ILV",
"ILX",
"IM",
"IMC",
"IMD",
"IMI",
"IML",
"IMM",
"IMV",
"IMX",
"IV",
"IVC",
"IVD",
"IVI",
"IVL",
"IVM",
"IVV",
"IVX",
"IX",
"IXC",
"IXD",
"IXI",
"IXL",
"IXM",
"IXV",
"IXX",
"L",
"LC",
"LD",
Expand All @@ -56,10 +97,36 @@
"VC",
"VD",
"VI",
"VIC",
"VID",
"VII",
"VIL",
"VIM",
"VIV",
"VIX",
"VL",
"VLC",
"VLI",
"VLL",
"VLV",
"VLX",
"VM",
"VV",
"VVC",
"VVD",
"VVI",
"VVL",
"VVM",
"VVV",
"VVX",
"VX",
"VXC",
"VXD",
"VXI",
"VXL",
"VXM",
"VXV",
"VXX",
"X",
"XC",
"XD",
Expand Down
33 changes: 33 additions & 0 deletions ivy/compiler/compiler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
from typing import Callable, Optional, List, Union, Iterable, Sequence, Mapping


def source_to_source(
object,
source: str = "torch",
target: str = "torch_frontend",
profiling: bool = False,
):
"""Converts a given object (class/function) from one framework to another.
This function performs source-to-source translation of a given object from the source framework
to the target framework.
The object can be translated between two frameworks or in-between the Ivy IR
as well e.g. (source="torch_frontend", target="ivy") or (source="torch_frontend", target="tensorflow") etc.
Args:
object: The object (class/function) to be translated.
source (str, optional): The source framework. Defaults to 'torch'.
target (str, optional): The target framework. Defaults to 'torch_frontend'.
profiling: Whether to add performance profiling.
Returns:
The translated object."""

from ._compiler import source_to_source as _source_to_source

return _source_to_source(
object=object,
source=source,
target=target,
profiling=profiling,
)


def trace_graph(
*objs: Callable,
stateful: Optional[List] = None,
Expand Down

0 comments on commit 6ce43b0

Please sign in to comment.