MCPcopy Create free account
hub / github.com/buaacxf/VIPTR / lambda_func

Method lambda_func

optimizer.py:124–128  ·  view source on GitHub ↗
(self, current_step, num_cycles=0.5)

Source from the content-addressed store, hash-verified

122 return lr_scheduler.LambdaLR(optimizer, self.lambda_func, self.last_epoch)
123
124 def lambda_func(self, current_step, num_cycles=0.5):
125 if current_step < self.warmup_epoch:
126 return float(current_step) / float(max(1, self.warmup_epoch))
127 progress = float(current_step - self.warmup_epoch) / float(max(1, self.epochs - self.warmup_epoch))
128 return max(0.0, 0.5 * (1.0 + math.cos(math.pi * float(num_cycles) * 2.0 * progress)))
129
130
131class PolynomialLR(object):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected