Class: DNN::Layers::Flatten
- Inherits:
-
Layer
- Object
- Layer
- DNN::Layers::Flatten
show all
- Defined in:
- lib/dnn/core/layers.rb
Instance Method Summary
collapse
Methods inherited from Layer
#build, #built?, #initialize, #prev_layer, #to_hash
Instance Method Details
#backward(dout) ⇒ Object
442
443
444
|
# File 'lib/dnn/core/layers.rb', line 442
def backward(dout)
dout.reshape(*@shape)
end
|
#forward(x) ⇒ Object
437
438
439
440
|
# File 'lib/dnn/core/layers.rb', line 437
def forward(x)
@shape = x.shape
x.reshape(x.shape[0], x.shape[1..-1].reduce(:*))
end
|
#shape ⇒ Object
446
447
448
|
# File 'lib/dnn/core/layers.rb', line 446
def shape
[prev_layer.shape.reduce(:*)]
end
|