#NEWLINE# def __init__( self , input_layer , num_units , W = nn . init . Uniform ( ) , b = nn . init . Constant ( 0.0 ) , nonlinearity = nn . nonlinearities . rectify ) : #NEWLINE# #INDENT# super ( SpatialDimReductionLayer , self ) . __init__ ( input_layer ) #NEWLINE# if ( nonlinearity is None ) : #NEWLINE# #INDENT# self . nonlinearity = nn . nonlinearities . identity #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . nonlinearity = nonlinearity #NEWLINE# #UNINDENT# self . num_units = num_units #NEWLINE# output_shape = self . input_layer . get_output_shape ( ) #NEWLINE# num_inputs = int ( np . prod ( output_shape [ 2 : ] ) ) #NEWLINE# self . W = self . create_param ( W , ( num_inputs , num_units ) ) #NEWLINE# self . b = ( self . create_param ( b , ( num_units , ) ) if ( b is not None ) else None )