(self,
                 steps=30,
                 l_optimizer=None,
                 l_optimizer_params={},
                 lr=None,
                 lr_end=None,
                 lr_decay=None,
                 lr_schedule=None,
                 lr_multiplier=None,
                 mb_iterations_per_l=0,
                 mb_iterations_first_l=0,
                 mu_init=0.,
                 mu_multiplier=1.,
                 mu_cap=10000,
                 distributed=False,
                 debugging_flags={})
Constructs an `LC` class instance.

        :param steps: Number of L-C iterations.
        :type steps: float
        :param l_optimizer: L-step optimizer to use.
        :param l_optimizer_params: L-step optimizer hyper-parameters.
        :type l_optimizer_params: dict
        :param lr: Starting learning rate.
        :type lr: float
        :param lr_end: Ending learning rate.
        :type lr_end: float
        :param lr_schedule: Learning rate schedule.
        :type lr_schedule: List
        :param lr_multiplier: Learning rate multiplier.
        :type lr_multiplier: float
        :param mb_iterations_per_l: Number of mini-batch iterations per L-step.
        :type mb_iterations_per_l: int
        :param mb_iterations_first_l: Number of mini-batch iterations for first L-step.
        :type mb_iterations_first_l: int
        :param mu_init: Initial value of `mu`.
        :type mu_init: float
        :param mu_multiplier: Mu multiplier.
        :type mu_multiplier: float
        :param mu_cap: Maximum permitted value for `mu`.
        :type mu_cap: float
        :param distributed: Enable/disable data-parallelism in L-step.
        :type distributed: bool
        :param debugging_flags: Debugging flags
        :type debugging_flags: dict
Constructs an `LC` class instance.
Constructs an LC class instance .
def __init__(self,
                 steps=30,
                 l_optimizer=None,
                 l_optimizer_params={},
                 lr=None,
                 lr_end=None,
                 lr_decay=None,
                 lr_schedule=None,
                 lr_multiplier=None,
                 mb_iterations_per_l=0,
                 mb_iterations_first_l=0,
                 mu_init=0.,
                 mu_multiplier=1.,
                 mu_cap=10000,
                 distributed=False,
                 debugging_flags={}):
        """
        Constructs an `LC` class instance.

        :param steps: Number of L-C iterations.
        :type steps: float
        :param l_optimizer: L-step optimizer to use.
        :param l_optimizer_params: L-step optimizer hyper-parameters.
        :type l_optimizer_params: dict
        :param lr: Starting learning rate.
        :type lr: float
        :param lr_end: Ending learning rate.
        :type lr_end: float
        :param lr_schedule: Learning rate schedule.
        :type lr_schedule: List
        :param lr_multiplier: Learning rate multiplier.
        :type lr_multiplier: float
        :param mb_iterations_per_l: Number of mini-batch iterations per L-step.
        :type mb_iterations_per_l: int
        :param mb_iterations_first_l: Number of mini-batch iterations for first L-step.
        :type mb_iterations_first_l: int
        :param mu_init: Initial value of `mu`.
        :type mu_init: float
        :param mu_multiplier: Mu multiplier.
        :type mu_multiplier: float
        :param mu_cap: Maximum permitted value for `mu`.
        :type mu_cap: float
        :param distributed: Enable/disable data-parallelism in L-step.
        :type distributed: bool
        :param debugging_flags: Debugging flags
        :type debugging_flags: dict
        """
        self._engine_config = {
            k: v
            for k, v in locals().items() if k != 'self'
        }
        logger.info('[Condensa] LC ENGINE CONFIG [' +
                    ', '.join('{!s}={!r}'.format(k, v)
                              for k, v in self._engine_config.items()) + ']')

        if not 0 <= steps:
            raise ValueError(
                'Invalid steps specified: {}'.format(steps))
        if not isinstance(l_optimizer_params, dict):
            raise TypeError('l_optimizer_params must be a dictionary')
        if not 0. <= lr:
            raise ValueError('Invalid learning rate: {}'.format(lr))
        if lr_schedule is not None and lr_multiplier is None:
            raise TypeError(
                'Please specify multiplier when using fixed LR schedule')
        if not 0 < mb_iterations_per_l:
            raise ValueError(
                'Invalid mb_iterations_per_l specified: {}'.format(mb_iterations_per_l))
        if not 0 < mb_iterations_first_l:
            raise ValueError(
                'Invalid mb_iterations_first_l specified: {}'.format(mb_iterations_first_l))
        if not isinstance(debugging_flags, dict):
            raise TypeError('debugging_flags must be a dictionary')

        self.use_cuda = torch.cuda.is_available()
        self.steps = steps
        self.l_optimizer = l_optimizer if l_optimizer else SGD
        self.l_optimizer_params = l_optimizer_params
        self.lr = lr
        self.lr_end = lr_end
        self.lr_decay = lr_decay
        self.lr_schedule = lr_schedule
        self.lr_multiplier = lr_multiplier
        self.mb_iterations_per_l = mb_iterations_per_l
        self.mb_iterations_first_l = mb_iterations_first_l
        self.mu_init = mu_init
        self.mu_multiplier = mu_multiplier
        self.mu_cap = mu_cap
        self.distributed = distributed
        self.debugging_flags = debugging_flags
def __init__ ( self , steps = 30 , l_optimizer = None , l_optimizer_params = { } , lr = None , lr_end = None , lr_decay = None , lr_schedule = None , lr_multiplier = None , mb_iterations_per_l = 0 , mb_iterations_first_l = 0 , mu_init = 0. , mu_multiplier = 1. , mu_cap = 10000 , distributed = False , debugging_flags = { } ) : self . _engine_config = { k : v for k , v in locals ( ) . items ( ) if k != 'self' } logger . info ( '[Condensa] LC ENGINE CONFIG [' + ', ' . join ( '{!s}={!r}' . format ( k , v ) for k , v in self . _engine_config . items ( ) ) + ']' ) if not 0 <= steps : raise ValueError ( 'Invalid steps specified: {}' . format ( steps ) ) if not isinstance ( l_optimizer_params , dict ) : raise TypeError ( 'l_optimizer_params must be a dictionary' ) if not 0. <= lr : raise ValueError ( 'Invalid learning rate: {}' . format ( lr ) ) if lr_schedule is not None and lr_multiplier is None : raise TypeError ( 'Please specify multiplier when using fixed LR schedule' ) if not 0 < mb_iterations_per_l : raise ValueError ( 'Invalid mb_iterations_per_l specified: {}' . format ( mb_iterations_per_l ) ) if not 0 < mb_iterations_first_l : raise ValueError ( 'Invalid mb_iterations_first_l specified: {}' . format ( mb_iterations_first_l ) ) if not isinstance ( debugging_flags , dict ) : raise TypeError ( 'debugging_flags must be a dictionary' ) self . use_cuda = torch . cuda . is_available ( ) self . steps = steps self . l_optimizer = l_optimizer if l_optimizer else SGD self . l_optimizer_params = l_optimizer_params self . lr = lr self . lr_end = lr_end self . lr_decay = lr_decay self . lr_schedule = lr_schedule self . lr_multiplier = lr_multiplier self . mb_iterations_per_l = mb_iterations_per_l self . mb_iterations_first_l = mb_iterations_first_l self . mu_init = mu_init self . mu_multiplier = mu_multiplier self . mu_cap = mu_cap self . distributed = distributed self . debugging_flags = debugging_flags