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.



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

#meanObject (readonly)

Returns the value of attribute mean.



23
24
25
# File 'lib/dnn/core/initializers.rb', line 23

def mean
  @mean
end

#stdObject (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_hashObject



39
40
41
# File 'lib/dnn/core/initializers.rb', line 39

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