NAME

AI::MXNet::Module - FeedForward interface of MXNet.
See AI::MXNet::Module::Base for the details.

load

Create a model from previously saved checkpoint.

Parameters
----------
prefix : str
    path prefix of saved model files. You should have
    "prefix-symbol.json", "prefix-xxxx.params", and
    optionally "prefix-xxxx.states", where xxxx is the
    epoch number.
epoch : int
    epoch to load.
load_optimizer_states : bool
    whether to load optimizer states. Checkpoint needs
    to have been made with save_optimizer_states=True.
data_names : array ref of str
    Default is ['data'] for a typical model used in image classification.
label_names : array ref of str
    Default is ['softmax_label'] for a typical model used in image
    classification.
logger : Logger
    Default is AI::MXNet::Logging.
context : Context or list of Context
    Default is cpu(0).
work_load_list : array ref of number
    Default is undef, indicating an uniform workload.
fixed_param_names: array ref of str
    Default is undef, indicating no network parameters are fixed.

save_checkpoint

Save current progress to a checkpoint.
Use mx->callback->module_checkpoint as epoch_end_callback to save during training.

Parameters
----------
prefix : str
    The file prefix to checkpoint to
epoch : int
    The current epoch number
save_optimizer_states : bool
    Whether to save optimizer states for later training

model_save_checkpoint

Checkpoint the model data into file.

Parameters
----------
prefix : str
    Prefix of model name.
epoch : int
    The epoch number of the model.
symbol : AI::MXNet::Symbol
    The input symbol
arg_params : hash ref of str to AI::MXNet::NDArray
    Model parameter, hash ref of name to AI::MXNet::NDArray of net's weights.
aux_params : hash ref of str to NDArray
    Model parameter, hash ref of name to AI::MXNet::NDArray of net's auxiliary states.
Notes
-----
- prefix-symbol.json will be saved for symbol.
- prefix-epoch.params will be saved for parameters.

bind

Bind the symbols to construct executors. This is necessary before one
can perform computation with the module.

Parameters
----------
:$data_shapes : ArrayRef[AI::MXNet::DataDesc|NameShape]
    Typically is $data_iter->provide_data.
:$label_shapes : Maybe[ArrayRef[AI::MXNet::DataDesc|NameShape]]
    Typically is $data_iter->provide_label.
:$for_training : bool
    Default is 1. Whether the executors should be bind for training.
:$inputs_need_grad : bool
    Default is 0. Whether the gradients to the input data need to be computed.
    Typically this is not needed. But this might be needed when implementing composition
    of modules.
:$force_rebind : bool
    Default is 0. This function does nothing if the executors are already
    binded. But with this 1, the executors will be forced to rebind.
:$shared_module : Module
    Default is undef. This is used in bucketing. When not undef, the shared module
    essentially corresponds to a different bucket -- a module with different symbol
    but with the same sets of parameters (e.g. unrolled RNNs with different lengths).

reshape

Reshape the module for new input shapes.
Parameters
----------
:$data_shapes : ArrayRef[AI::MXNet::DataDesc]
    Typically is $data_iter->provide_data.
:$label_shapes= : Maybe[ArrayRef[AI::MXNet::DataDesc]]
    Typically is $data_iter->provide_label.

borrow_optimizer

Borrow optimizer from a shared module. Used in bucketing, where exactly the same
optimizer (esp. kvstore) is used.

Parameters
----------
shared_module : AI::MXNet::Module

_sync_params_from_devices

Synchronize parameters from devices to CPU. This function should be called after
calling 'update' that updates the parameters on the devices, before one can read the
latest parameters from $self->_arg_params and $self->_aux_params.