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, #name

Instance Method Summary collapse

Methods inherited from Layer

#backward, #build, #built?, #call, call, #forward, from_hash, #load_hash, #output_shape, #to_hash

Constructor Details

#initializeHasParamLayer

Returns a new instance of HasParamLayer.



86
87
88
89
# File 'lib/dnn/core/layers.rb', line 86

def initialize
  super()
  @trainable = true
end

Instance Attribute Details

#trainableBoolean

Returns Setting false prevents learning of parameters.

Returns:

  • (Boolean)

    Setting false prevents learning of parameters.



84
85
86
# File 'lib/dnn/core/layers.rb', line 84

def trainable
  @trainable
end

Instance Method Details

#get_paramsArray

Returns The parameters of the layer.

Returns:

  • (Array)

    The parameters of the layer.

Raises:

  • (NotImplementedError)


92
93
94
# File 'lib/dnn/core/layers.rb', line 92

def get_params
  raise NotImplementedError.new("Class '#{self.class.name}' has implement method 'get_params'")
end