mxnet.model

MXNet model module

Classes

BatchEndParam

BatchEndParams(epoch, nbatch, eval_metric, locals)

Functions

load_checkpoint(prefix, epoch)

Load model checkpoint from file.

load_params(prefix, epoch)

Load params from a file

save_checkpoint(prefix, epoch, symbol, …)

Checkpoint the model data into file.

mxnet.model.BatchEndParam

epoch

Alias for field number 0

eval_metric

Alias for field number 2

locals

Alias for field number 3

nbatch

Alias for field number 1

Attributes

alias of mxnet.model.BatchEndParams

mxnet.model.load_checkpoint(prefix, epoch)[source]

Load model checkpoint from file.

Parameters
  • prefix (str) – Prefix of model name.

  • epoch (int) – Epoch number of model we would like to load.

Returns

  • symbol (Symbol) – The symbol configuration of computation network.

  • arg_params (dict of str to NDArray) – Model parameter, dict of name to NDArray of net’s weights.

  • aux_params (dict of str to NDArray) – Model parameter, dict of name to NDArray of net’s auxiliary states.

Notes

  • Symbol will be loaded from prefix-symbol.json.

  • Parameters will be loaded from prefix-epoch.params.

mxnet.model.load_params(prefix, epoch)[source]

Load params from a file

mxnet.model.save_checkpoint(prefix, epoch, symbol, arg_params, aux_params, remove_amp_cast=True)[source]

Checkpoint the model data into file.

Parameters
  • prefix (str) – Prefix of model name.

  • epoch (int) – The epoch number of the model.

  • symbol (Symbol) – The input Symbol.

  • arg_params (dict of str to NDArray) – Model parameter, dict of name to NDArray of net’s weights.

  • aux_params (dict of str to NDArray) – Model parameter, dict of name to NDArray of net’s auxiliary states.

  • remove_amp_cast (bool, optional) – Whether to remove the amp_cast and amp_multicast operators, before saving the model.

Notes

  • prefix-symbol.json will be saved for symbol.

  • prefix-epoch.params will be saved for parameters.