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
Instance Method Summary
collapse
Methods inherited from Layer
#build, #built?, #initialize, #to_hash
Instance Method Details
#backward(dout) ⇒ Object
239
240
241
|
# File 'lib/dnn/core/layers.rb', line 239
def backward(dout)
dout.reshape(dout.shape[0], *@input_shape)
end
|
#forward(x) ⇒ Object
235
236
237
|
# File 'lib/dnn/core/layers.rb', line 235
def forward(x)
x.reshape(x.shape[0], *output_shape)
end
|
#output_shape ⇒ Object
243
244
245
|
# File 'lib/dnn/core/layers.rb', line 243
def output_shape
[@input_shape.reduce(:*)]
end
|