Upgrade black to 22.1.0 and fix the corresponding issues

This commit is contained in:
D-X-Y 2022-03-20 23:18:23 -07:00
parent 8d0799dfb1
commit 676e8e411d
3 changed files with 3 additions and 3 deletions

View File

@ -156,7 +156,7 @@ class Logger(object):
hist.max = float(np.max(values)) hist.max = float(np.max(values))
hist.num = int(np.prod(values.shape)) hist.num = int(np.prod(values.shape))
hist.sum = float(np.sum(values)) 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 # Drop the start of the first bin
bin_edges = bin_edges[1:] bin_edges = bin_edges[1:]

View File

@ -155,7 +155,7 @@ class ExponentialLR(_LRScheduler):
if self.current_epoch >= self.warmup_epochs: if self.current_epoch >= self.warmup_epochs:
last_epoch = self.current_epoch - self.warmup_epochs last_epoch = self.current_epoch - self.warmup_epochs
assert last_epoch >= 0, "invalid last_epoch : {:}".format(last_epoch) 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: else:
lr = ( lr = (
self.current_epoch / self.warmup_epochs self.current_epoch / self.warmup_epochs

View File

@ -122,7 +122,7 @@ class ExponentialParamScheduler(ParamScheduler):
self._decay = decay self._decay = decay
def __call__(self, where: float) -> float: def __call__(self, where: float) -> float:
return self._start_value * (self._decay ** where) return self._start_value * (self._decay**where)
class LinearParamScheduler(ParamScheduler): class LinearParamScheduler(ParamScheduler):