Fixes EarlyStopping With Precision=16 (#1996)

* Patch for issue 1815, which will allow EarlyStopping to work on precision=16

* Added a whitespace to the end of the line so CICD can rerun. No reason for the latest macos test to have been cancelled.

* Format.
This commit is contained in:
authman 2020-05-31 14:02:19 -05:00 committed by GitHub
parent 8b9b923ca8
commit bf39cb26c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -107,7 +107,7 @@ class EarlyStopping(Callback):
# Allow instances to be re-used
self.wait = 0
self.stopped_epoch = 0
self.best = torch_inf if self.monitor_op == torch.lt else -torch_inf
self.best = -torch_inf if self.monitor_op(torch.Tensor(1), torch.Tensor(2))[0].item() else torch_inf
def on_validation_end(self, trainer, pl_module):
self._run_early_stopping_check(trainer, pl_module)