class neupy.layers.GlobalPooling[source]

Global pooling layer.

function : {avg, max} or callable

Common functions has been predefined for the user. These options are available:

  • avg - For average global pooling. The same as tf.reduce_mean.
  • max - For average global pooling. The same as tf.reduce_max.

Parameters also excepts custom functions that have following format.

def agg_func(x, axis=None):

Defaults to avg.

name : str or None

Layer’s identifier. If name is equal to None than name will be generated automatically. Defaults to None.


>>> from neupy.layers import *
>>> network = Input((4, 4, 16)) > GlobalPooling('avg')
>>> network.output_shape
input_shape : tuple

Returns layer’s input shape in the form of a tuple. Shape will not include batch size dimension.

output_shape : tuple

Returns layer’s output shape in the form of a tuple. Shape will not include batch size dimension.

training_state : bool

Defines whether layer in training state or not. Training state will enable some operations inside of the layers that won’t work otherwise.

parameters : dict

Parameters that networks uses during propagation. It might include trainable and non-trainable parameters.

graph : LayerGraph instance

Graphs that stores all relations between layers.


disable_training_state() Context manager that switches off trainig state.
initialize() Set up important configurations related to the layer.
function = None[source]
options = {'function': Option(class_name='GlobalPooling', value=FunctionWithOptionsProperty(name="function")), 'name': Option(class_name='BaseLayer', value=Property(name="name"))}[source]

Return output base on the input value.