Class: DNN::Initializers::RandomNormal

Inherits:
Initializer show all
Defined in:
lib/dnn/core/initializers.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mean = 0, std = 0.05) ⇒ RandomNormal

Returns a new instance of RandomNormal.



32
33
34
35
# File 'lib/dnn/core/initializers.rb', line 32

def initialize(mean = 0, std = 0.05)
  @mean = mean
  @std = std
end

Instance Attribute Details

#meanObject (readonly)

Returns the value of attribute mean.



25
26
27
# File 'lib/dnn/core/initializers.rb', line 25

def mean
  @mean
end

#stdObject (readonly)

Returns the value of attribute std.



26
27
28
# File 'lib/dnn/core/initializers.rb', line 26

def std
  @std
end

Class Method Details

.load_hash(hash) ⇒ Object



28
29
30
# File 'lib/dnn/core/initializers.rb', line 28

def self.load_hash(hash)
  self.new(hash[:mean], hash[:std])
end

Instance Method Details

#init_param(layer, param_key) ⇒ Object



37
38
39
# File 'lib/dnn/core/initializers.rb', line 37

def init_param(layer, param_key)
  super(layer, param_key, layer.params[param_key].rand_norm(@mean, @std))
end

#to_hashObject



41
42
43
# File 'lib/dnn/core/initializers.rb', line 41

def to_hash
  super({mean: @mean, std: @std})
end