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, #output_shape, #to_hash

Constructor Details

#initialize ⇒ HasParamLayer

Returns a new instance of HasParamLayer.



72
73
74
75
# File 'lib/dnn/core/layers.rb', line 72

def initialize
  super()
  @trainable = true
end

Instance Attribute Details

#trainable ⇒ Boolean

Returns Setting false prevents learning of parameters.

Returns:

  • (Boolean) —

    Setting false prevents learning of parameters.



70
71
72
# File 'lib/dnn/core/layers.rb', line 70

def trainable
  @trainable
end

Instance Method Details

#get_params ⇒ Array

Returns The parameters of the layer.

Returns:

  • (Array) —

    The parameters of the layer.

Raises:

  • (NotImplementedError)


78
79
80
# File 'lib/dnn/core/layers.rb', line 78

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