Skip to content

Commit

Permalink
Fix faulty logic in __call__ method of Runner class, fixes fastai#370 (
Browse files Browse the repository at this point in the history
…fastai#372)

* Fix faulty logic in __call__ method of Runner class, fixes fastai#370

Change `res = cb(cb_name) and res` to `res = cb(cb_name) or res`
so that `__call__` method does not always return `False` but returns
`True` if at least one of the callbacks returns `True`.

* Strip changed notebook 05b_early_stopping
  • Loading branch information
fg91 authored and jph00 committed Oct 21, 2019
1 parent 5064621 commit 9e2dabb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nbs/dl2/05b_early_stopping.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
"\n",
" def __call__(self, cb_name):\n",
" res = False\n",
" for cb in sorted(self.cbs, key=lambda x: x._order): res = cb(cb_name) and res\n",
" for cb in sorted(self.cbs, key=lambda x: x._order): res = cb(cb_name) or res\n",
" return res"
]
},
Expand Down

0 comments on commit 9e2dabb

Please sign in to comment.