Class: DNN::Layers::InputLayer

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Layer

#build, #builded?, #prev_layer

Constructor Details

#initialize(dim_or_shape) ⇒ InputLayer

Returns a new instance of InputLayer.



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

def initialize(dim_or_shape)
  @shape = dim_or_shape.is_a?(Array) ? dim_or_shape : [dim_or_shape]
end

Instance Attribute Details

#shapeObject (readonly)

Returns the value of attribute shape.



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

def shape
  @shape
end

Class Method Details

.load_hash(hash) ⇒ Object



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

def self.load_hash(hash)
  self.new(hash[:shape])
end

Instance Method Details

#backward(dout) ⇒ Object



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

def backward(dout)
  dout
end

#forward(x) ⇒ Object



82
83
84
# File 'lib/dnn/core/layers.rb', line 82

def forward(x)
  x
end

#to_hashObject



90
91
92
# File 'lib/dnn/core/layers.rb', line 90

def to_hash
  {name: self.class.name, shape: @shape}
end