ParameterDict¶
-
class
ParameterDict(prefix='', shared=None)¶ 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’sget()method creates a new parameter, will first try to retrieve it from “shared” dict. Usually used for sharing parameters with another Block.
- prefix : str, default
Load and save parameters¶
ParameterDict.load(self, filename[, ctx, …]) |
Load parameters from file. |
ParameterDict.save(self, filename[, …]) |
Save parameters to file. |
Get a particular parameter¶
ParameterDict.get(self, name, \*\*kwargs) |
Retrieves a Parameter with name self.prefix+name. |
ParameterDict.get_constant(self, name[, value]) |
Retrieves a Constant with name self.prefix+name. |
Get (name, paramter) pairs¶
ParameterDict.items(self) |
|
ParameterDict.keys(self) |
|
ParameterDict.values(self) |
Update parameters¶
ParameterDict.initialize(self[, init, ctx, …]) |
Initializes all Parameters managed by this dictionary to be used for NDArray API. |
ParameterDict.setattr(self, name, value) |
Set an attribute to a new value for all Parameters. |
ParameterDict.update(self, other) |
Copies all Parameters in other to self. |
Set devices contexts and gradients¶
ParameterDict.reset_ctx(self, ctx) |
Re-assign all Parameters to other contexts. |
ParameterDict.zero_grad(self) |
Sets all Parameters’ gradient buffer to 0. |
Attributes¶
ParameterDict.prefix |
Prefix of this dict. |