Class: DNN::Initializers::RandomUniform

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(min = -0.25,, max = 0.25) ⇒ RandomUniform



55
56
57
58
# File 'lib/dnn/core/initializers.rb', line 55

def initialize(min = -0.25, max = 0.25)
  @min = min
  @max = max
end

Instance Attribute Details

#max ⇒ Object (readonly)

Returns the value of attribute max.



49
50
51
# File 'lib/dnn/core/initializers.rb', line 49

def max
  @max
end

#min ⇒ Object (readonly)

Returns the value of attribute min.



48
49
50
# File 'lib/dnn/core/initializers.rb', line 48

def min
  @min
end

Class Method Details

.load_hash(hash) ⇒ Object



51
52
53
# File 'lib/dnn/core/initializers.rb', line 51

def self.load_hash(hash)
  self.new(hash[:min], hash[:max])
end

Instance Method Details

#init_param(layer, param_key) ⇒ Object



60
61
62
# File 'lib/dnn/core/initializers.rb', line 60

def init_param(layer, param_key)
  super(layer, param_key, layer.params[param_key].rand(@min, @max))
end

#to_hash ⇒ Object



64
65
66
# File 'lib/dnn/core/initializers.rb', line 64

def to_hash
  super({min: @min, max: @max})
end