Class: DNN::Initializers::RandomNormal
- Inherits:
-
Initializer
- Object
- Initializer
- DNN::Initializers::RandomNormal
- Defined in:
- lib/dnn/core/initializers.rb
Instance Attribute Summary collapse
-
#mean ⇒ Object
readonly
Returns the value of attribute mean.
-
#std ⇒ Object
readonly
Returns the value of attribute std.
Class Method Summary collapse
Instance Method Summary collapse
- #init_param(layer, param_key) ⇒ Object
-
#initialize(mean = 0, std = 0.05) ⇒ RandomNormal
constructor
A new instance of RandomNormal.
- #to_hash ⇒ Object
Constructor Details
#initialize(mean = 0, std = 0.05) ⇒ RandomNormal
Returns a new instance of RandomNormal.
30 31 32 33 |
# File 'lib/dnn/core/initializers.rb', line 30 def initialize(mean = 0, std = 0.05) @mean = mean @std = std end |
Instance Attribute Details
#mean ⇒ Object (readonly)
Returns the value of attribute mean.
23 24 25 |
# File 'lib/dnn/core/initializers.rb', line 23 def mean @mean end |
#std ⇒ Object (readonly)
Returns the value of attribute std.
24 25 26 |
# File 'lib/dnn/core/initializers.rb', line 24 def std @std end |
Class Method Details
.load_hash(hash) ⇒ Object
26 27 28 |
# File 'lib/dnn/core/initializers.rb', line 26 def self.load_hash(hash) self.new(hash[:mean], hash[:std]) end |
Instance Method Details
#init_param(layer, param_key) ⇒ Object
35 36 37 |
# File 'lib/dnn/core/initializers.rb', line 35 def init_param(layer, param_key) super(layer, param_key, layer.params[param_key].rand_norm(@mean, @std)) end |
#to_hash ⇒ Object
39 40 41 |
# File 'lib/dnn/core/initializers.rb', line 39 def to_hash super({mean: @mean, std: @std}) end |