Class: DNN::Layers::HasParamLayer

Inherits:
Layer
  • Object
show all
Defined in:
lib/dnn/core/layers.rb

Overview

This class is a superclass of all classes with learning parameters.

Direct Known Subclasses

BatchNormalization, Connection, Embedding

Instance Attribute Summary collapse

Attributes inherited from Layer

#input_shape, #learning_phase

Instance Method Summary collapse

Methods inherited from Layer

#backward, #build, #built?, #forward, #output_shape, #to_hash

Constructor Details

#initialize ⇒ HasParamLayer

Returns a new instance of HasParamLayer.



62
63
64
65
66
# File 'lib/dnn/core/layers.rb', line 62

def initialize
  super()
  @params = {}
  @trainable = true
end

Instance Attribute Details

#params ⇒ Array (readonly)

Returns The parameters of the layer.

Returns:

  • (Array) —

    The parameters of the layer.



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

def params
  @params
end

#trainable ⇒ Bool

Returns trainable Setting false prevents learning of parameters.

Returns:

  • (Bool) —

    trainable Setting false prevents learning of parameters.



58
59
60
# File 'lib/dnn/core/layers.rb', line 58

def trainable
  @trainable
end