Skip to content

Commit 8b2209b

Browse files
committed
refactor: remove redundant import check
1 parent a313f90 commit 8b2209b

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

lantern/early_stopping.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
from typing import Optional
2+
import torch.utils.tensorboard
23

34
from lantern import FunctionalBase
45

5-
try:
6-
import torch.utils.tensorboard
7-
8-
SummaryWriter = torch.utils.tensorboard.SummaryWriter
9-
except ImportError:
10-
SummaryWriter = None
11-
pass
12-
136

147
class EarlyStopping(FunctionalBase):
158
"""Keeps track of the best score and how long ago it was calculated."""
169

17-
tensorboard_logger: SummaryWriter
10+
tensorboard_logger: torch.utils.tensorboard.SummaryWriter
1811
best_score: Optional[float] = None
1912
scores_since_improvement: int = -1
2013

0 commit comments

Comments
 (0)