Class: DNN::Layers::Layer

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

Overview

Super class of all optimizer classes.

Instance Method Summary collapse

Constructor Details

#initializeLayer

Returns a new instance of Layer.



8
9
10
# File 'lib/dnn/core/layers.rb', line 8

def initialize
  @builded = false
end

Instance Method Details

#backwardObject

Backward propagation.



26
# File 'lib/dnn/core/layers.rb', line 26

def backward() end

#build(model) ⇒ Object

Initialize layer when model is compiled.



13
14
15
16
# File 'lib/dnn/core/layers.rb', line 13

def build(model)
  @builded = true
  @model = model
end

#builded?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/dnn/core/layers.rb', line 18

def builded?
  @builded
end

#forwardObject

Forward propagation.



23
# File 'lib/dnn/core/layers.rb', line 23

def forward() end

#prev_layerObject

Get the previous layer.



39
40
41
# File 'lib/dnn/core/layers.rb', line 39

def prev_layer
  @model.layers[@model.layers.index(self) - 1]
end

#shapeObject

Get the shape of the layer.



29
30
31
# File 'lib/dnn/core/layers.rb', line 29

def shape
  prev_layer.shape
end

#to_hashObject

Layer to a hash.



34
35
36
# File 'lib/dnn/core/layers.rb', line 34

def to_hash
  {name: self.class.name}
end