Class: DNN::Layers::Flatten
- Inherits:
-
Layer
- Object
- Layer
- DNN::Layers::Flatten
show all
- Defined in:
- lib/dnn/core/layers/basic_layers.rb
Instance Attribute Summary
Attributes inherited from Layer
#input_shape
Instance Method Summary
collapse
Methods inherited from Layer
#build, #built?, call, #call, #clean, from_hash, #initialize, #load_hash, #to_hash
Instance Method Details
#backward(dy) ⇒ Object
314
315
316
|
# File 'lib/dnn/core/layers/basic_layers.rb', line 314
def backward(dy)
dy.reshape(dy.shape[0], *@input_shape)
end
|
#forward(x) ⇒ Object
310
311
312
|
# File 'lib/dnn/core/layers/basic_layers.rb', line 310
def forward(x)
x.reshape(x.shape[0], *output_shape)
end
|
#output_shape ⇒ Object
318
319
320
|
# File 'lib/dnn/core/layers/basic_layers.rb', line 318
def output_shape
[@input_shape.reduce(:*)]
end
|