Class: DNN::Layers::GRU

Inherits:
RNN show all
Defined in:
lib/dnn/core/rnn_layers.rb

Instance Attribute Summary

Attributes inherited from RNN

#h, #num_nodes, #stateful, #weight_decay

Attributes inherited from HasParamLayer

#grads, #params, #trainable

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RNN

#backward, #forward, #ridge, #shape, #to_hash

Methods inherited from HasParamLayer

#build, #update

Methods inherited from Layer

#backward, #build, #built?, #forward, #prev_layer, #shape, #to_hash

Constructor Details

#initialize(num_nodes, stateful: false, return_sequences: true, weight_initializer: nil, bias_initializer: nil, weight_decay: 0) ⇒ GRU

Returns a new instance of GRU.



367
368
369
370
371
372
373
374
# File 'lib/dnn/core/rnn_layers.rb', line 367

def initialize(num_nodes,
               stateful: false,
               return_sequences: true,
               weight_initializer: nil,
               bias_initializer: nil,
               weight_decay: 0)
  super
end

Class Method Details

.load_hash(hash) ⇒ Object



358
359
360
361
362
363
364
365
# File 'lib/dnn/core/rnn_layers.rb', line 358

def self.load_hash(hash)
  self.new(hash[:num_nodes],
           stateful: hash[:stateful],
           return_sequences: hash[:return_sequences],
           weight_initializer: Util.load_hash(hash[:weight_initializer]),
           bias_initializer: Util.load_hash(hash[:bias_initializer]),
           weight_decay: hash[:weight_decay])
end