utils.py
def step(self):
        """Conducts one step of learning rate and momentum update
        """
        current_step = self.last_step + 1
        self.last_step = current_step

        if current_step <= self.num_cycle_steps // 2:
            # Scale up phase
            scale = current_step / (self.num_cycle_steps // 2)
            lr = self.min_lr + (self.max_lr - self.min_lr) * scale
            momentum = self.max_momentum - \
                (self.max_momentum - self.min_momentum) * scale
        elif current_step <= self.num_cycle_steps:
            # Scale down phase
            scale = (current_step - self.num_cycle_steps // 2) / \
                (self.num_cycle_steps - self.num_cycle_steps // 2)
            lr = self.max_lr - (self.max_lr - self.min_lr) * scale
            momentum = self.min_momentum + \
                (self.max_momentum - self.min_momentum) * scale
        elif current_step <= self.num_steps:
            # Annihilation phase: only change lr
            scale = (current_step - self.num_cycle_steps) / \
                (self.num_steps - self.num_cycle_steps)
            lr = self.min_lr - (self.min_lr - self.final_lr) * scale
            momentum = None
        else:
            # Exceeded given num_steps: do nothing
            return

        self.optimizer.param_groups[0]['lr'] = lr
        if momentum:
            self.optimizer.param_groups[0]['momentum'] = momentum
Conducts one step of learning rate and momentum update
        
Conducts one step of learning rate and momentum update
Conducts one step of learning rate and momentum update
def step(self):
        current_step = self.last_step + 1
        self.last_step = current_step
        if current_step <= self.num_cycle_steps // 2:
            scale = current_step / (self.num_cycle_steps // 2)
            lr = self.min_lr + (self.max_lr - self.min_lr) * scale
            momentum = self.max_momentum - \
                (self.max_momentum - self.min_momentum) * scale
        elif current_step <= self.num_cycle_steps:
            scale = (current_step - self.num_cycle_steps // 2) / \
                (self.num_cycle_steps - self.num_cycle_steps // 2)
            lr = self.max_lr - (self.max_lr - self.min_lr) * scale
            momentum = self.min_momentum + \
                (self.max_momentum - self.min_momentum) * scale
        elif current_step <= self.num_steps:
            scale = (current_step - self.num_cycle_steps) / \
                (self.num_steps - self.num_cycle_steps)
            lr = self.min_lr - (self.min_lr - self.final_lr) * scale
            momentum = None
        else:
            return
        self.optimizer.param_groups[0]['lr'] = lr
        if momentum:
            self.optimizer.param_groups[0]['momentum'] = momentum
def step ( self ) : current_step = self . last_step + 1 self . last_step = current_step if current_step <= self . num_cycle_steps // 2 : scale = current_step / ( self . num_cycle_steps // 2 ) lr = self . min_lr + ( self . max_lr - self . min_lr ) * scale momentum = self . max_momentum - ( self . max_momentum - self . min_momentum ) * scale elif current_step <= self . num_cycle_steps : scale = ( current_step - self . num_cycle_steps // 2 ) / ( self . num_cycle_steps - self . num_cycle_steps // 2 ) lr = self . max_lr - ( self . max_lr - self . min_lr ) * scale momentum = self . min_momentum + ( self . max_momentum - self . min_momentum ) * scale elif current_step <= self . num_steps : scale = ( current_step - self . num_cycle_steps ) / ( self . num_steps - self . num_cycle_steps ) lr = self . min_lr - ( self . min_lr - self . final_lr ) * scale momentum = None else : return self . optimizer . param_groups [ 0 ] [ 'lr' ] = lr if momentum : self . optimizer . param_groups [ 0 ] [ 'momentum' ] = momentum
Conducts one step of learning rate and momentum update
Conducts one step of learning rate and momentum update
"""Conducts one step of learning rate and momentum update
        """ # Scale up phase # Scale down phase # Annihilation phase: only change lr # Exceeded given num_steps: do nothing
self