Skip to content

Commit

Permalink
fix lint (keras-team#168)
Browse files Browse the repository at this point in the history
Co-authored-by: Haifeng Jin <[email protected]>
  • Loading branch information
2 people authored and fchollet committed May 14, 2023
1 parent e1e9ec5 commit eed2e7a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 21 deletions.
13 changes: 9 additions & 4 deletions keras_core/layers/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ def stateless_call(
Args:
trainable_variables: List of trainable variables of the model.
non_trainable_variables: List of non-trainable variables of the model.
non_trainable_variables: List of non-trainable variables of the
model.
*args: Positional argumets to be passed to `call()`.
return_losses: If `True`, `stateless_call()` will return the list of
losses created during `call()` as part of its return values.
Expand Down Expand Up @@ -504,7 +505,9 @@ def stateless_call(
)
# Attach the updated state to the model
# (until you do this, the model is still in its pre-call state).
for ref_var, value in zip(model.non_trainable_variables, non_trainable_variables):
for ref_var, value in zip(
model.non_trainable_variables, non_trainable_variables
):
ref_var.assign(value)
```
"""
Expand Down Expand Up @@ -597,7 +600,8 @@ def compute_output_spec(self, *args, **kwargs):
and isinstance(output_shape[0], (int, type(None)))
):
return KerasTensor(output_shape, dtype=self.compute_dtype)
# Case: nested. Could be a tuple/list of shapes, or a dict of shapes.
# Case: nested. Could be a tuple/list of shapes, or a dict of
# shapes.
if isinstance(output_shape, list):
return [
KerasTensor(s, dtype=self.compute_dtype)
Expand Down Expand Up @@ -770,7 +774,8 @@ def _maybe_build(self, call_spec):
"In a layer with multiple tensor arguments "
"in call(), the build() method should accept "
"corresponding `*_shape` arguments, e.g. "
"if the call signature is `def call(self, x1, x2)` "
"if the call signature is "
"`def call(self, x1, x2)` "
"then the build signature should be "
"`def build(self, x1_shape, x2_shape)`. "
"Keras will not build this layer automatically "
Expand Down
4 changes: 2 additions & 2 deletions keras_core/trainers/epoch_iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ def __init__(
)
if class_weight is not None:
raise ValueError(
"Argument `class_weight` is not supported for Python generator "
f"inputs. Received: class_weight={class_weight}"
"Argument `class_weight` is not supported for Python "
f"generator inputs. Received: class_weight={class_weight}"
)
if shuffle:
raise ValueError(
Expand Down
3 changes: 2 additions & 1 deletion pip_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ def build():

whl_path = None
try:
# Copy sources (`keras_core/` directory and setup files) to build directory
# Copy sources (`keras_core/` directory and setup files) to build
# directory
root_path = pathlib.Path(__file__).parent.resolve()
os.chdir(root_path)
os.mkdir(build_directory)
Expand Down
14 changes: 0 additions & 14 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,4 @@ per-file-ignores =
# import not used
**/__init__.py:F401
**/random.py:F401
# TODO: remove the following files when long lines are reformatted.
keras_core/trainers/trainer.py:E501
keras_core/trainers/epoch_iterator.py:E501
keras_core/trainers/data_adapters/array_data_adapter.py:E501
keras_core/trainers/compile_utils.py:E501
keras_core/saving/object_registration.py:E501
keras_core/regularizers/regularizers.py:E501
keras_core/optimizers/optimizer.py:E501
keras_core/operations/function.py:E501
keras_core/models/sequential.py:E501
keras_core/models/functional.py:E501
keras_core/layers/layer.py:E501
keras_core/initializers/random_initializers.py:E501
keras_core/saving/saving_lib_test.py:E501
max-line-length = 80

0 comments on commit eed2e7a

Please sign in to comment.