Go to the documentation of this file.00001 import mxnet as mx
00002
00003
00004 def save_checkpoint(prefix, epoch, arg_params, aux_params):
00005 """Checkpoint the model data into file.
00006 :param prefix: Prefix of model name.
00007 :param epoch: The epoch number of the model.
00008 :param arg_params: dict of str to NDArray
00009 Model parameter, dict of name to NDArray of net's weights.
00010 :param aux_params: dict of str to NDArray
00011 Model parameter, dict of name to NDArray of net's auxiliary states.
00012 :return: None
00013 prefix-epoch.params will be saved for parameters.
00014 """
00015 save_dict = {('arg:%s' % k) : v for k, v in arg_params.items()}
00016 save_dict.update({('aux:%s' % k) : v for k, v in aux_params.items()})
00017 param_name = '%s-%04d.params' % (prefix, epoch)
00018 mx.nd.save(param_name, save_dict)