neuroprob/utils/pytorch.py
def step(self, closure=None):
        """ Performs a single optimization step.
        Arguments:
            closure (callable, optional): A closure that reevaluates the model
                and returns the loss.
        """
        loss = None
        if closure is not None:
            loss = closure()

        for group in self.param_groups:
            weight_decay = group['weight_decay']
            large_lr = (group['lr']*group['kappa'])/(group['smallConst'])
            Alpha = 1.0 - ((group['smallConst']*group['smallConst']*group['xi'])/group['kappa'])
            Beta = 1.0 - Alpha
            zeta = group['smallConst']/(group['smallConst']+Beta)
            for p in group['params']:
                if p.grad is None:
                    continue
                d_p = p.grad.data
                if weight_decay != 0:
                    d_p.add_(weight_decay, p.data)
                param_state = self.state[p]
                if 'momentum_buffer' not in param_state:
                    param_state['momentum_buffer'] = copy.deepcopy(p.data)
                buf = param_state['momentum_buffer']
                buf.mul_((1.0/Beta)-1.0)
                buf.add_(-large_lr,d_p)
                buf.add_(p.data)
                buf.mul_(Beta)

                p.data.add_(-group['lr'],d_p)
                p.data.mul_(zeta)
                p.data.add_(1.0-zeta,buf)

        return loss
 Performs a single optimization step.
        Arguments:
            closure (callable, optional): A closure that reevaluates the model
                and returns the loss.
        
Performs a single optimization step.
Performs a single optimization step .
def step(self, closure=None):
        loss = None
        if closure is not None:
            loss = closure()
        for group in self.param_groups:
            weight_decay = group['weight_decay']
            large_lr = (group['lr']*group['kappa'])/(group['smallConst'])
            Alpha = 1.0 - ((group['smallConst']*group['smallConst']*group['xi'])/group['kappa'])
            Beta = 1.0 - Alpha
            zeta = group['smallConst']/(group['smallConst']+Beta)
            for p in group['params']:
                if p.grad is None:
                    continue
                d_p = p.grad.data
                if weight_decay != 0:
                    d_p.add_(weight_decay, p.data)
                param_state = self.state[p]
                if 'momentum_buffer' not in param_state:
                    param_state['momentum_buffer'] = copy.deepcopy(p.data)
                buf = param_state['momentum_buffer']
                buf.mul_((1.0/Beta)-1.0)
                buf.add_(-large_lr,d_p)
                buf.add_(p.data)
                buf.mul_(Beta)
                p.data.add_(-group['lr'],d_p)
                p.data.mul_(zeta)
                p.data.add_(1.0-zeta,buf)
        return loss
def step ( self , closure = None ) : loss = None if closure is not None : loss = closure ( ) for group in self . param_groups : weight_decay = group [ 'weight_decay' ] large_lr = ( group [ 'lr' ] * group [ 'kappa' ] ) / ( group [ 'smallConst' ] ) Alpha = 1.0 - ( ( group [ 'smallConst' ] * group [ 'smallConst' ] * group [ 'xi' ] ) / group [ 'kappa' ] ) Beta = 1.0 - Alpha zeta = group [ 'smallConst' ] / ( group [ 'smallConst' ] + Beta ) for p in group [ 'params' ] : if p . grad is None : continue d_p = p . grad . data if weight_decay != 0 : d_p . add_ ( weight_decay , p . data ) param_state = self . state [ p ] if 'momentum_buffer' not in param_state : param_state [ 'momentum_buffer' ] = copy . deepcopy ( p . data ) buf = param_state [ 'momentum_buffer' ] buf . mul_ ( ( 1.0 / Beta ) - 1.0 ) buf . add_ ( - large_lr , d_p ) buf . add_ ( p . data ) buf . mul_ ( Beta ) p . data . add_ ( - group [ 'lr' ] , d_p ) p . data . mul_ ( zeta ) p . data . add_ ( 1.0 - zeta , buf ) return loss
Performs a single optimization step.
Performs a single optimization step .
""" Performs a single optimization step.
        Arguments:
            closure (callable, optional): A closure that reevaluates the model
                and returns the loss.
        """
self
closure
A closure that reevaluates the model
and returns the loss.
A closure that reevaluates the model and returns the loss .