From de95d39bd71d9a896a9199e218385fe3673b0707 Mon Sep 17 00:00:00 2001 From: ivy-dev-bot Date: Sun, 15 Sep 2024 04:04:31 +0000 Subject: [PATCH] auto-lint code --- binaries.json | 2 +- ivy/compiler/compiler.py | 31 +++++++++++-------- .../torch/serialization/serialization.py | 10 ++++-- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/binaries.json b/binaries.json index ce0e90a46d3c..e5e7a17a7144 100644 --- a/binaries.json +++ b/binaries.json @@ -149,4 +149,4 @@ } ] } -} \ No newline at end of file +} diff --git a/ivy/compiler/compiler.py b/ivy/compiler/compiler.py index c59dc9a8340d..4cec6f1c0d97 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( @@ -96,6 +96,7 @@ 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'. @@ -106,8 +107,9 @@ def source_to_source( the old implementation. Defaults to 'True'. Returns: - The translated object.""" - + ------- + The translated object. + """ from ._compiler import source_to_source as _source_to_source return _source_to_source( @@ -138,7 +140,8 @@ 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 ---------- @@ -208,8 +211,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( @@ -249,6 +252,7 @@ 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'. @@ -259,8 +263,9 @@ def transpile( the old implementation. Defaults to 'True'. Returns: - The translated object.""" - + ------- + The translated object. + """ from ._compiler import transpile as _transpile return _transpile( diff --git a/ivy/functional/frontends/torch/serialization/serialization.py b/ivy/functional/frontends/torch/serialization/serialization.py index 444cc7df249f..620fe1344947 100644 --- a/ivy/functional/frontends/torch/serialization/serialization.py +++ b/ivy/functional/frontends/torch/serialization/serialization.py @@ -14,7 +14,9 @@ def load( mmap: Optional[bool] = None, **pickle_load_args: Any, ) -> Any: - raise ivy.exceptions.IvyNotImplementedException("The `torch.load` frontend has not yet been implemented.") + raise ivy.exceptions.IvyNotImplementedException( + "The `torch.load` frontend has not yet been implemented." + ) def save( @@ -23,6 +25,8 @@ def save( pickle_module: Any = None, pickle_protocol: int = 2, _use_new_zipfile_serialization: bool = True, - _disable_byteorder_record: bool = False + _disable_byteorder_record: bool = False, ) -> None: - raise ivy.exceptions.IvyNotImplementedException("The `torch.save` frontend has not yet been implemented.") + raise ivy.exceptions.IvyNotImplementedException( + "The `torch.save` frontend has not yet been implemented." + )