class MXNet::Gluon::ParameterDict
- MXNet::Gluon::ParameterDict
- Reference
- Object
Overview
A dictionary managing a set of Parameters.
Included Modules
- Enumerable({String, MXNet::Gluon::Parameter})
Defined in:
mxnet/gluon/parameter.crConstructors
-
.new(prefix = "", shared = nil)
Creates a new instance.
Instance Method Summary
-
#==(other : self)
Returns
trueif this reference is the same as other. -
#each(&)
Must yield this collection's elements to the block.
-
#get(name, **kwargs)
Retrieves a
Parameterwith name "<prefix><name>". - #has_key?(key)
- #has_value?(value)
- #init(init = nil, ctx = nil, force_reinit = false)
- #keys
-
#load(fname, ctx = nil, allow_missing = false, ignore_extra = false, restore_prefix = "")
Loads parameters from a file.
-
#prefix : String
Prefix of this dict.
-
#save(fname, strip_prefix = "")
Saves parameters to a file.
-
#to_s(io)
Writes this object to an
IO. -
#update(other : Enumerable(Tuple(String, Parameter)))
Copies all
Parameters in other into this dict. - #values
Constructor Detail
Instance Method Detail
Returns true if this reference is the same as other. Invokes same?.
Must yield this collection's elements to the block.
Retrieves a Parameter with name "<prefix><name>". If not
found, #get will first try to retrieve it from shared
dict. If still not found, #get will create a new Parameter
with key-word arguments and both store and return it.
Parameters
- name (
String) Name of the desiredParameter. It will be prepended with this dict's prefix.
Initializes all Parameters managed by this dict for use with
NDArray API. It has no effect when using Symbol API.
Parameters
- init (
Initializer, optional) The initializer to use. - ctx (
Context|Array(Context), optional) Desired contexts. InitializesParameteron given contexts. - force_reinit (
Boolean, default =false) Whether to force re-initialization if parameters are already initialized.
Loads parameters from a file.
Parameters
- fname (
String) Path to parameter file. - ctx (
Context|Array(Context), default =nil) Context(s) to initialize loaded parameters on. - allow_missing (
Bool, default =false) Whether to silently skip loading parameters not present in the file. - ignore_extra (
Bool, default =false) Whether to silently ignore parameters from the file that are not present in this dict. - restore_prefix (
String, default = "") Prefix to prepend to names of stored parameters before loading.
Saves parameters to a file.
Parameters
- fname (
String) Path to parameter file. - strip_prefix (
String, default = "") Prefix to strip from parameter names before saving.