#NEWLINE# def __init__( self , input_layer , pool_size , stride = None ) : #NEWLINE# #INDENT# '\n        This implements stochastic pooling as in Zeiler et al. 2013 to replace max pooling.\n        Pooling is stochastic by default. When dropout_active=True, weighted pooling is used\n        instead. As a result it is not possible to enable/disable stochastic pooling and\n        dropout separately within a network, but the use cases for that should be rare.\n        Usually we want both on during training, and both off at test time.\n\n        pool_size is an INTEGER, not a tuple. We can only do square pooling windows.\n        \n        if the stride is none, it is taken to be the same as the pool size.\n\n        borders are never ignored.\n        ' #NEWLINE# self . pool_size = pool_size #NEWLINE# self . stride = ( stride if ( stride is not None ) else pool_size ) #NEWLINE# self . input_layer = input_layer #NEWLINE# self . params = [ ] #NEWLINE# self . bias_params = [ ] #NEWLINE# self . mb_size = self . input_layer . mb_size #NEWLINE# self . stochastic_pool_op = StochasticMaxPool ( ds = pool_size . pool_size , stride = self . stride ) #NEWLINE# self . weighted_pool_op = WeightedMaxPool ( ds = self . pool_size , stride = self . stride )