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.
Instance Method Summary collapse
- #init_param(layer, param) ⇒ Object
-
#initialize(mean = 0, std = 0.05, seed: true) ⇒ RandomNormal
constructor
A new instance of RandomNormal.
- #load_hash(hash) ⇒ Object
- #to_hash ⇒ Object
Methods inherited from Initializer
Constructor Details
#initialize(mean = 0, std = 0.05, seed: true) ⇒ RandomNormal
Returns a new instance of RandomNormal.
72 73 74 75 76 |
# File 'lib/dnn/core/initializers.rb', line 72 def initialize(mean = 0, std = 0.05, seed: true) super(seed: seed) @mean = mean @std = std end |
Instance Attribute Details
#mean ⇒ Object (readonly)
Returns the value of attribute mean.
67 68 69 |
# File 'lib/dnn/core/initializers.rb', line 67 def mean @mean end |
#std ⇒ Object (readonly)
Returns the value of attribute std.
68 69 70 |
# File 'lib/dnn/core/initializers.rb', line 68 def std @std end |
Instance Method Details
#init_param(layer, param) ⇒ Object
78 79 80 81 |
# File 'lib/dnn/core/initializers.rb', line 78 def init_param(layer, param) Xumo::SFloat.srand(@seed) param.data = param.data.rand_norm(@mean, @std) end |
#load_hash(hash) ⇒ Object
87 88 89 |
# File 'lib/dnn/core/initializers.rb', line 87 def load_hash(hash) initialize(hash[:mean], hash[:std], seed: hash[:seed]) end |
#to_hash ⇒ Object
83 84 85 |
# File 'lib/dnn/core/initializers.rb', line 83 def to_hash super(mean: @mean, std: @std) end |