From 676e8e411d0e3263469f3eb1b2aaf05e0fa42751 Mon Sep 17 00:00:00 2001 From: D-X-Y <280835372@qq.com> Date: Sun, 20 Mar 2022 23:18:23 -0700 Subject: [PATCH] Upgrade black to 22.1.0 and fix the corresponding issues --- xautodl/log_utils/logger.py | 2 +- xautodl/procedures/optimizers.py | 2 +- xautodl/xmisc/scheduler_utils.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xautodl/log_utils/logger.py b/xautodl/log_utils/logger.py index 3da517d..71f3866 100644 --- a/xautodl/log_utils/logger.py +++ b/xautodl/log_utils/logger.py @@ -156,7 +156,7 @@ class Logger(object): hist.max = float(np.max(values)) hist.num = int(np.prod(values.shape)) hist.sum = float(np.sum(values)) - hist.sum_squares = float(np.sum(values ** 2)) + hist.sum_squares = float(np.sum(values**2)) # Drop the start of the first bin bin_edges = bin_edges[1:] diff --git a/xautodl/procedures/optimizers.py b/xautodl/procedures/optimizers.py index 3dd1f00..813ba8d 100644 --- a/xautodl/procedures/optimizers.py +++ b/xautodl/procedures/optimizers.py @@ -155,7 +155,7 @@ class ExponentialLR(_LRScheduler): if self.current_epoch >= self.warmup_epochs: last_epoch = self.current_epoch - self.warmup_epochs assert last_epoch >= 0, "invalid last_epoch : {:}".format(last_epoch) - lr = base_lr * (self.gamma ** last_epoch) + lr = base_lr * (self.gamma**last_epoch) else: lr = ( self.current_epoch / self.warmup_epochs diff --git a/xautodl/xmisc/scheduler_utils.py b/xautodl/xmisc/scheduler_utils.py index df0ffdf..773fca8 100644 --- a/xautodl/xmisc/scheduler_utils.py +++ b/xautodl/xmisc/scheduler_utils.py @@ -122,7 +122,7 @@ class ExponentialParamScheduler(ParamScheduler): self._decay = decay def __call__(self, where: float) -> float: - return self._start_value * (self._decay ** where) + return self._start_value * (self._decay**where) class LinearParamScheduler(ParamScheduler):