Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update compiler.py 8a734de #28778

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading