Lr_scheduler help

Could someone help me understanding this code line by line? Thank you

import math
import numpy as np

from torch.optim.optimizer import Optimizer

class AdjustLR(object):
def init(self, optimizer, init_lr, sleep_epochs=5, half=5, verbose=0):
super(AdjustLR, self).init()
self.optimizer = optimizer
self.sleep_epochs = sleep_epochs
self.half = half
self.init_lr = init_lr
self.verbose = verbose

def step(self, epoch):
    if epoch >= self.sleep_epochs:
        for idx, param_group in enumerate(self.optimizer.param_groups):
            new_lr = self.init_lr[idx] * math.pow(0.5, (epoch-self.sleep_epochs+1)/float(self.half))
            param_group['lr'] = new_lr
        if self.verbose:
            print('>>> reduce learning rate <<<')

Do you have any questions to a particular line of code?
Could you post, what you’ve understood so far and let us know, what’s confusing?

i have difficulties in understanding how to move it to matlab and which functions i need to change. Is there a toolbox maybe to do that?

Sorry, I’m not familiar with deep learning tools in MATLAB, as I’ve just used it for signal processing in the past.
I’m not sure if this is the best place to ask. Maybe you could get better help in the MATLAB forum, if you explain your use case (i.e. what you would like to achieve).