Table Of Contents
Table Of Contents

ParameterDict

class mxnet.gluon.ParameterDict(prefix='', shared=None)[source]

A dictionary managing a set of parameters.

Parameters
  • prefix (str, default '') – The prefix to be prepended to all Parameters’ names created by this dict.

  • shared (ParameterDict or None) – If not None, when this dict’s get() method creates a new parameter, will first try to retrieve it from “shared” dict. Usually used for sharing parameters with another Block.

Load and save parameters

ParameterDict.load(filename[, ctx, …])

Load parameters from file.

ParameterDict.save(filename[, strip_prefix])

Save parameters to file.

Get a particular parameter

ParameterDict.get(name, **kwargs)

Retrieves a Parameter with name self.prefix+name.

ParameterDict.get_constant(name[, value])

Retrieves a Constant with name self.prefix+name.

Update parameters

ParameterDict.initialize([init, ctx, …])

Initializes all Parameters managed by this dictionary to be used for NDArray API.

ParameterDict.setattr(name, value)

Set an attribute to a new value for all Parameters.

ParameterDict.update(other)

Copies all Parameters in other to self.

Set devices contexts and gradients

ParameterDict.reset_ctx(ctx)

Re-assign all Parameters to other contexts.

ParameterDict.zero_grad()

Sets all Parameters’ gradient buffer to 0.

Attributes

ParameterDict.prefix

Prefix of this dict.