Class: DNN::Layers::Flatten
- Inherits:
-
Layer
- Object
- Layer
- DNN::Layers::Flatten
show all
- Defined in:
- lib/dnn/core/layers.rb
Instance Attribute Summary
Attributes inherited from Layer
#input_shape, #name
Instance Method Summary
collapse
Methods inherited from Layer
#build, #built?, call, #call, from_hash, #initialize, #load_hash, #to_hash
Instance Method Details
#backward(dy) ⇒ Object
291
292
293
|
# File 'lib/dnn/core/layers.rb', line 291
def backward(dy)
dy.reshape(dy.shape[0], *@input_shape)
end
|
#forward(x) ⇒ Object
287
288
289
|
# File 'lib/dnn/core/layers.rb', line 287
def forward(x)
x.reshape(x.shape[0], *output_shape)
end
|
#output_shape ⇒ Object
295
296
297
|
# File 'lib/dnn/core/layers.rb', line 295
def output_shape
[@input_shape.reduce(:*)]
end
|