Skip to content

Commit

Permalink
Further formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fchollet committed Jan 10, 2018
1 parent 9357c41 commit 86a0e2c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion keras/layers/recurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def build(self, input_shape):

if self.state_spec is not None:
# initial_state was passed in call, check compatibility
if not [spec.shape[-1] for spec in self.state_spec] == state_size:
if [spec.shape[-1] for spec in self.state_spec] != state_size:
raise ValueError(
'An initial_state was passed that is not compatible with '
'`cell.state_size`. Received `state_spec`={}; '
Expand Down
5 changes: 3 additions & 2 deletions keras/preprocessing/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,10 +940,11 @@ def next(self):


def _count_valid_files_in_directory(directory, white_list_formats, follow_links):
"""Count files with extension in `white_list_formats` contained in a directory.
"""Count files with extension in `white_list_formats` contained in directory.
# Arguments
directory: absolute path to the directory containing files to be counted
directory: absolute path to the directory
containing files to be counted
white_list_formats: set of strings containing allowed extensions for
the files to be counted.
follow_links: boolean.
Expand Down
11 changes: 7 additions & 4 deletions keras/utils/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ def _wait_queue(self):
return

def _run(self):
"""Function to submit request to the executor and queue the `Future` objects."""
"""Submits request to the executor and queue the `Future` objects."""
sequence = list(range(len(self.sequence)))
self._send_sequence() # Share the initial sequence
while True:
Expand Down Expand Up @@ -625,10 +625,13 @@ def _data_generator_task(self):
while not self._stop_event.is_set():
with self.genlock:
try:
if self.queue is not None and self.queue.qsize() < self.max_queue_size:
# On all OSes, avoid **SYSTEMATIC** error in multithreading mode:
if (self.queue is not None and
self.queue.qsize() < self.max_queue_size):
# On all OSes, avoid **SYSTEMATIC** error
# in multithreading mode:
# `ValueError: generator already executing`
# => Serialize calls to infinite iterator/generator's next() function
# => Serialize calls to
# infinite iterator/generator's next() function
generator_output = next(self._generator)
self.queue.put((True, generator_output))
else:
Expand Down

0 comments on commit 86a0e2c

Please sign in to comment.