From 1017717491f6383ce7b043cf05ec5ebc76eb87b3 Mon Sep 17 00:00:00 2001 From: Sam Armstrong <88863522+Sam-Armstrong@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:05:51 +0100 Subject: [PATCH] Update compiler.py 802c8e2 (#28807) Co-authored-by: ivy-dev-bot --- binaries.json | 3 ++- ivy/compiler/compiler.py | 31 +++++++++++++------------------ 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/binaries.json b/binaries.json index 3d2cc4d79468..c9ce861da977 100644 --- a/binaries.json +++ b/binaries.json @@ -12,6 +12,7 @@ "CM", "CV", "CX", + "D", "DC", "DD", "DI", @@ -145,4 +146,4 @@ } ] } -} +} \ No newline at end of file diff --git a/ivy/compiler/compiler.py b/ivy/compiler/compiler.py index 70e6cfb89da0..dac695e8232a 100644 --- a/ivy/compiler/compiler.py +++ b/ivy/compiler/compiler.py @@ -2,15 +2,15 @@ def clear_graph_cache(): - """Clears the graph cache which gets populated if `graph_caching` is set to - `True` in `ivy.trace_graph`, `ivy.transpile` or `ivy.unify`. Use this to + """Clears the graph cache which gets populated if `graph_caching` is set + to `True` in `ivy.trace_graph`, `ivy.transpile` or `ivy.unify`. Use this to reset or clear the graph cache if needed. Examples -------- >>> import ivy - >>> ivy.clear_graph_cache() - """ + >>> ivy.clear_graph_cache()""" + from ._compiler import clear_graph_cache as _clear_graph_cache return _clear_graph_cache() @@ -55,8 +55,8 @@ def graph_transpile( Returns ------- - Either a transpiled Graph or a non-initialized LazyGraph. - """ + Either a transpiled Graph or a non-initialized LazyGraph.""" + from ._compiler import graph_transpile as _graph_transpile return _graph_transpile( @@ -93,16 +93,14 @@ def source_to_source( 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 'tensorflow'. profiling: Whether to add performance profiling. Returns: - ------- - The translated object. - """ + The translated object.""" + from ._compiler import source_to_source as _source_to_source return _source_to_source( @@ -133,8 +131,7 @@ def trace_graph( params_v=None, v=None ): - """Takes `fn` and traces it into a more efficient composition of backend - operations. + """Takes `fn` and traces it into a more efficient composition of backend operations. Parameters ---------- @@ -204,8 +201,8 @@ def trace_graph( >>> start = time.time() >>> graph(x) >>> print(time.time() - start) - 0.0001785755157470703 - """ + 0.0001785755157470703""" + from ._compiler import trace_graph as _trace_graph return _trace_graph( @@ -242,16 +239,14 @@ def transpile( 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 'tensorflow'. profiling: Whether to add performance profiling. Returns: - ------- - The translated object. - """ + The translated object.""" + from ._compiler import transpile as _transpile return _transpile(