NAME

AI::MXNet::Gluon::Trainer

DESCRIPTION

Applies an `Optimizer` on a set of Parameters. Trainer should
be used together with `autograd`.

Parameters
----------
params : ParameterDict
    The set of parameters to optimize.
optimizer : str or Optimizer
    The optimizer to use. See
    `help <http://mxnet.io/api/python/optimization/optimization.html#the-mxnet-optimizer-package>`_
    on Optimizer for a list of available optimizers.
optimizer_params : dict
    Key-word arguments to be passed to optimizer constructor. For example,
    `{'learning_rate': 0.1}`. All optimizers accept learning_rate, wd (weight decay),
    clip_gradient, and lr_scheduler. See each optimizer's
    constructor for a list of additional supported arguments.
kvstore : str or KVStore
    kvstore type for multi-gpu and distributed training. See help on
    :any:`mxnet.kvstore.create` for more information.

step

Makes one step of parameter update. Should be called after
`autograd.compute_gradient` and outside of `record()` scope.

Parameters
----------
batch_size : int
    Batch size of data processed. Gradient will be normalized by `1/batch_size`.
    Set this to 1 if you normalized loss manually with `loss = mean(loss)`.
ignore_stale_grad : bool, optional, default=False
    If true, ignores Parameters with stale gradient (gradient that has not
    been updated by `backward` after last step) and skip update.

set_learning_rate

Sets a new learning rate of the optimizer.

Parameters
----------
lr : float
    The new learning rate of the optimizer.

save_states

Saves trainer states (e.g. optimizer, momentum) to a file.

Parameters
----------
fname : str
    Path to output states file.

load_states

Loads trainer states (e.g. optimizer, momentum) from a file.

Parameters
----------
fname : str
    Path to input states file.