neon.optimizers.optimizer.StepSchedule

class neon.optimizers.optimizer.StepSchedule(step_config, change)[source]

Bases: neon.optimizers.optimizer.Schedule

Steps the learning rate over training time.

To set a step schedule, pass as arguments step_config and change. The schedule will set the learning rate at step[i] to change[i]. For example, the call:

schedule = Schedule(step_config=[2, 6], change=[0.6, 0.4])

will set the learning rate to 0.6 at step 2, and to 0.4 at step 6.

__init__(step_config, change)[source]

Class constructor.

Parameters:
  • step_config (list) – Configure the step times (list of epoch indices)
  • change (list) – List of learning rates. Must be same length as step_config

Methods

__init__(step_config, change) Class constructor.
gen_class(pdict)
get_description([skip]) Returns a dict that contains all necessary information needed to serialize this object.
get_learning_rate(learning_rate, epoch) Returns the current learning rate given the epoch and initial learning rate.
recursive_gen(pdict, key) helper method to check whether the definition
be = None
classnm

Returns the class name.

gen_class(pdict)
get_description(skip=[], **kwargs)

Returns a dict that contains all necessary information needed to serialize this object.

Parameters:skip (list) – Objects to omit from the dictionary.
Returns:Dictionary format for object information.
Return type:(dict)
get_learning_rate(learning_rate, epoch)[source]

Returns the current learning rate given the epoch and initial learning rate.

Parameters:
  • learning_rate (float) – Initial learning rate
  • epoch (int) – Current epoch, used to calculate the adjusted learning rate
Returns:

The adjusted learning rate

Return type:

(float)

modulenm

Returns the full module path.

recursive_gen(pdict, key)

helper method to check whether the definition dictionary is defining a NervanaObject child, if so it will instantiate that object and replace the dictionary element with an instance of that object