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, #built?, #prev_layer

Constructor Details

#initialize(dim_or_shape) ⇒ InputLayer

Returns a new instance of InputLayer.



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

def initialize(dim_or_shape)
  super()
  @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.



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

def shape
  @shape
end

Class Method Details

.load_hash(hash) ⇒ Object



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

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

Instance Method Details

#backward(dout) ⇒ Object



102
103
104
# File 'lib/dnn/core/layers.rb', line 102

def backward(dout)
  dout
end

#forward(x) ⇒ Object



98
99
100
# File 'lib/dnn/core/layers.rb', line 98

def forward(x)
  x
end

#to_hashObject



106
107
108
# File 'lib/dnn/core/layers.rb', line 106

def to_hash
  super({shape: @shape})
end