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
230
231
232
|
# File 'lib/dnn/core/layers.rb', line 230
def backward(dout)
dout.reshape(dout.shape[0], *@input_shape)
end
|
#forward(x) ⇒ Object
226
227
228
|
# File 'lib/dnn/core/layers.rb', line 226
def forward(x)
x.reshape(x.shape[0], *output_shape)
end
|
#output_shape ⇒ Object
234
235
236
|
# File 'lib/dnn/core/layers.rb', line 234
def output_shape
[@input_shape.reduce(:*)]
end
|