Class: DNN::Layers::GlobalAvgPool2D
- Defined in:
- lib/dnn/core/layers/cnn_layers.rb
Instance Attribute Summary
Attributes inherited from Layer
Instance Method Summary collapse
Methods inherited from Layer
#built?, call, #call, #clean, from_hash, #initialize, #load_hash, #output_shape, #to_hash
Constructor Details
This class inherits a constructor from DNN::Layers::Layer
Instance Method Details
#build(input_shape) ⇒ Object
396 397 398 399 400 401 |
# File 'lib/dnn/core/layers/cnn_layers.rb', line 396 def build(input_shape) unless input_shape.length == 3 raise DNN_ShapeError, "Input shape is #{input_shape}. But input shape must be 3 dimensional." end super end |
#forward(x) ⇒ Object
403 404 405 |
# File 'lib/dnn/core/layers/cnn_layers.rb', line 403 def forward(x) Flatten.(AvgPool2D.(x, input_shape[0..1])) end |