Class: DNN::Initializers::RandomUniform
- Inherits:
-
Initializer
- Object
- Initializer
- DNN::Initializers::RandomUniform
- Defined in:
- lib/dnn/core/initializers.rb
Instance Attribute Summary collapse
-
#max ⇒ Object
readonly
Returns the value of attribute max.
-
#min ⇒ Object
readonly
Returns the value of attribute min.
Class Method Summary collapse
Instance Method Summary collapse
- #init_param(layer, param) ⇒ Object
-
#initialize(min = -0.05,, max = 0.05) ⇒ RandomUniform
constructor
A new instance of RandomUniform.
- #to_hash ⇒ Object
Constructor Details
#initialize(min = -0.05,, max = 0.05) ⇒ RandomUniform
Returns a new instance of RandomUniform.
75 76 77 78 |
# File 'lib/dnn/core/initializers.rb', line 75 def initialize(min = -0.05, max = 0.05) @min = min @max = max end |
Instance Attribute Details
#max ⇒ Object (readonly)
Returns the value of attribute max.
69 70 71 |
# File 'lib/dnn/core/initializers.rb', line 69 def max @max end |
#min ⇒ Object (readonly)
Returns the value of attribute min.
68 69 70 |
# File 'lib/dnn/core/initializers.rb', line 68 def min @min end |
Class Method Details
.load_hash(hash) ⇒ Object
71 72 73 |
# File 'lib/dnn/core/initializers.rb', line 71 def self.load_hash(hash) self.new(hash[:min], hash[:max]) end |
Instance Method Details
#init_param(layer, param) ⇒ Object
80 81 82 |
# File 'lib/dnn/core/initializers.rb', line 80 def init_param(layer, param) param.data = param.data.rand(@min, @max) end |
#to_hash ⇒ Object
84 85 86 |
# File 'lib/dnn/core/initializers.rb', line 84 def to_hash super({min: @min, max: @max}) end |