shiba/schedulers.py
def compute_lr(self):
        """
        Compute the learning rate based on which phase of the cycle it is in.
        - If in the first half of training, the learning rate gradually increases.
        - If in the second half of training, the learning rate gradually decreases.
        - If in the final `end_percentage` portion of training, the learning rate
            is quickly reduced to near 100th of the original min learning rate.
        # Returns:
            the new learning rate
        """
        if self.clr_iterations > 2 * self.mid_cycle_id:
            current_percentage = (self.clr_iterations - 2 * self.mid_cycle_id)
            current_percentage /= float((self.num_iterations - 2 * self.mid_cycle_id))
            new_lr = self.initial_lr * (1. + (current_percentage *
                                              (1. - 100.) / 100.)) * self.scale

        elif self.clr_iterations > self.mid_cycle_id:
            current_percentage = 1. - (
                    self.clr_iterations - self.mid_cycle_id) / self.mid_cycle_id
            new_lr = self.initial_lr * (1. + current_percentage *
                                        (self.scale * 100 - 1.)) * self.scale

        else:
            current_percentage = self.clr_iterations / self.mid_cycle_id
            new_lr = self.initial_lr * (1. + current_percentage *
                                        (self.scale * 100 - 1.)) * self.scale

        if self.clr_iterations == self.num_iterations:
            self.clr_iterations = 0

        return new_lr

        Compute the learning rate based on which phase of the cycle it is in.
        - If in the first half of training, the learning rate gradually increases.
        - If in the second half of training, the learning rate gradually decreases.
        - If in the final `end_percentage` portion of training, the learning rate
            is quickly reduced to near 100th of the original min learning rate.
        # Returns:
            the new learning rate
        
Compute the learning rate based on which phase of the cycle it is in.
If in the first half of training, the learning rate gradually increases.
If in the second half of training, the learning rate gradually decreases.
If in the final `end_percentage` portion of training, the learning rate
is quickly reduced to near 100th of the original min learning rate.
Returns:
the new learning rate
Compute the learning rate based on which phase of the cycle it is in . If in the first half of training the learning rate gradually increases . If in the second half of training the learning rate gradually decreases . If in the final ` end_percentage ` portion of training the learning rate is quickly reduced to near 100th of the original min learning rate . Returns : the new learning rate
def compute_lr(self):
        if self.clr_iterations > 2 * self.mid_cycle_id:
            current_percentage = (self.clr_iterations - 2 * self.mid_cycle_id)
            current_percentage /= float((self.num_iterations - 2 * self.mid_cycle_id))
            new_lr = self.initial_lr * (1. + (current_percentage *
                                              (1. - 100.) / 100.)) * self.scale
        elif self.clr_iterations > self.mid_cycle_id:
            current_percentage = 1. - (
                    self.clr_iterations - self.mid_cycle_id) / self.mid_cycle_id
            new_lr = self.initial_lr * (1. + current_percentage *
                                        (self.scale * 100 - 1.)) * self.scale
        else:
            current_percentage = self.clr_iterations / self.mid_cycle_id
            new_lr = self.initial_lr * (1. + current_percentage *
                                        (self.scale * 100 - 1.)) * self.scale
        if self.clr_iterations == self.num_iterations:
            self.clr_iterations = 0
        return new_lr
def compute_lr ( self ) : if self . clr_iterations > 2 * self . mid_cycle_id : current_percentage = ( self . clr_iterations - 2 * self . mid_cycle_id ) current_percentage /= float ( ( self . num_iterations - 2 * self . mid_cycle_id ) ) new_lr = self . initial_lr * ( 1. + ( current_percentage * ( 1. - 100. ) / 100. ) ) * self . scale elif self . clr_iterations > self . mid_cycle_id : current_percentage = 1. - ( self . clr_iterations - self . mid_cycle_id ) / self . mid_cycle_id new_lr = self . initial_lr * ( 1. + current_percentage * ( self . scale * 100 - 1. ) ) * self . scale else : current_percentage = self . clr_iterations / self . mid_cycle_id new_lr = self . initial_lr * ( 1. + current_percentage * ( self . scale * 100 - 1. ) ) * self . scale if self . clr_iterations == self . num_iterations : self . clr_iterations = 0 return new_lr
Compute the learning rate based on which phase of the cycle it is in.
Compute the learning rate based on which phase of the cycle it is in .
"""
        Compute the learning rate based on which phase of the cycle it is in.
        - If in the first half of training, the learning rate gradually increases.
        - If in the second half of training, the learning rate gradually decreases.
        - If in the final `end_percentage` portion of training, the learning rate
            is quickly reduced to near 100th of the original min learning rate.
        # Returns:
            the new learning rate
        """
self