Class: DNN::Layers::Flatten
Instance Attribute Summary
Attributes inherited from Layer
#input_shape, #output_shape
Instance Method Summary
collapse
Methods included from LayerNode
#forward
Methods inherited from Layer
#build, #built?, call, #call, #clean, #forward, from_hash, #initialize, #load_hash, #to_hash
Instance Method Details
#backward_node(dy) ⇒ Object
310
311
312
|
# File 'lib/dnn/core/layers/basic_layers.rb', line 310
def backward_node(dy)
dy.reshape(dy.shape[0], *@input_shape)
end
|
#compute_output_shape ⇒ Object
314
315
316
|
# File 'lib/dnn/core/layers/basic_layers.rb', line 314
def compute_output_shape
[@input_shape.reduce(:*)]
end
|
#forward_node(x) ⇒ Object
306
307
308
|
# File 'lib/dnn/core/layers/basic_layers.rb', line 306
def forward_node(x)
x.reshape(x.shape[0], *@output_shape)
end
|