neupy.layers.GlobalPooling

class neupy.layers.GlobalPooling[source]

Global pooling layer.

Parameters:
function : {avg, max, sum} 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 max global pooling. The same as tf.reduce_max.
  • sum - For sum global pooling. The same as tf.reduce_sum.

Parameter also excepts custom functions that have following format.

def agg_func(x, axis=None):
    pass

Defaults to avg.

name : str or None

Layer’s name. Can be used as a reference to specific layer. When value specified as None than name will be generated from the class name. Defaults to None

Examples

>>> from neupy.layers import *
>>> network = Input((4, 4, 16)) >> GlobalPooling('avg')
(?, 4, 4, 16) -> [... 2 layers ...] -> (?, 16)
Attributes:
variables : dict

Variable names and their values. Dictionary can be empty in case if variables hasn’t been created yet.

Methods

variable(value, name, shape=None, trainable=True) Initializes variable with specified values.
get_output_shape(input_shape) Computes expected output shape from the layer based on the specified input shape.
output(*inputs, **kwargs) Propagetes input through the layer. The kwargs variable might contain additional information that propages through the network.
function = None[source]
get_output_shape(input_shape)[source]
options = {'function': Option(class_name='GlobalPooling', value=FunctionWithOptionsProperty(name="function")), 'name': Option(class_name='BaseLayer', value=Property(name="name"))}[source]
output(input_value, **kwargs)[source]