Skip to content

Commit

Permalink
auto-lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
ivy-dev-bot committed Jul 26, 2024
1 parent eeb6f0a commit 46df064
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion binaries.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,4 @@
}
]
}
}
}
17 changes: 10 additions & 7 deletions ivy/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ def source_to_source(
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."""

-------
The translated object.
"""
from ._compiler import source_to_source as _source_to_source

return _source_to_source(
Expand Down Expand Up @@ -54,7 +56,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
----------
Expand Down Expand Up @@ -124,8 +127,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(
Expand Down Expand Up @@ -189,8 +192,8 @@ def transpile(
Returns
-------
Either a transpiled Graph or a non-initialized LazyGraph."""

Either a transpiled Graph or a non-initialized LazyGraph.
"""
from ._compiler import transpile as _transpile

return _transpile(
Expand Down
8 changes: 5 additions & 3 deletions ivy/functional/backends/tensorflow/gradients.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ def execute_with_gradients(
# Conversion of KerasVariable to tf.Variable within xs_required container, so they can be watched
if ivy.is_ivy_container(xs_required):
ivy.nested_map(
lambda x: x._value
if "keras.src.backend.tensorflow.core.Variable" in str(x.__class__)
else x,
lambda x: (
x._value
if "keras.src.backend.tensorflow.core.Variable" in str(x.__class__)
else x
),
xs_required,
include_derived=True,
)
Expand Down
12 changes: 11 additions & 1 deletion ivy/stateful/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,17 @@ def _get_variable_name(variable):
self._native_params = ivy.Container(
OrderedDict(
sorted(
[(param.name if tf.__version__ < "2.16.0" else _get_variable_name(param), param) for param in self._native_module.variables],
[
(
(
param.name
if tf.__version__ < "2.16.0"
else _get_variable_name(param)
),
param,
)
for param in self._native_module.variables
],
key=lambda kv: kv[0],
)
),
Expand Down

0 comments on commit 46df064

Please sign in to comment.