Skip to content

Commit

Permalink
Remove force option in progbar
Browse files Browse the repository at this point in the history
  • Loading branch information
fchollet committed Feb 2, 2018
1 parent dc4dd03 commit a2e3d24
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion keras/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def on_epoch_end(self, epoch, logs=None):
if k in logs:
self.log_values.append((k, logs[k]))
if self.verbose:
self.progbar.update(self.seen, self.log_values, force=True)
self.progbar.update(self.seen, self.log_values)


class History(Callback):
Expand Down
8 changes: 4 additions & 4 deletions keras/utils/generic_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,14 @@ def __init__(self, target, width=30, verbose=1, interval=0.05):
sys.stdout.isatty()) or
'ipykernel' in sys.modules)

def update(self, current, values=None, force=False):
def update(self, current, values=None):
"""Updates the progress bar.
# Arguments
current: Index of current step.
values: List of tuples (name, value_for_last_step).
values: List of tuples:
`(name, value_for_last_step)`.
The progress bar will display averages for these values.
force: Whether to force visual progress update.
"""
values = values or []
for k, v in values:
Expand All @@ -327,7 +327,7 @@ def update(self, current, values=None, force=False):
now = time.time()
info = ' - %.0fs' % (now - self.start)
if self.verbose == 1:
if (not force and (now - self.last_update) < self.interval and
if (now - self.last_update < self.interval and
self.target is not None and current < self.target):
return

Expand Down
5 changes: 2 additions & 3 deletions tests/keras/utils/generic_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ def test_progbar():
for target in (len(values_s) - 1, None):
for verbose in (0, 1, 2):
bar = Progbar(target, width=30, verbose=verbose, interval=0.05)
for force in (False, True):
for current, values in enumerate(values_s):
bar.update(current, values=values, force=force)
for current, values in enumerate(values_s):
bar.update(current, values=values)


def test_custom_objects_scope():
Expand Down

0 comments on commit a2e3d24

Please sign in to comment.