#NEWLINE# def __init__( self , incoming , memory_shape , num_units , num_reads , W_in_to_hid = lasagne . init . GlorotUniform ( ) , b_in_to_hid = lasagne . init . Constant ( 0.0 ) , W_reads_to_hid = lasagne . init . GlorotUniform ( ) , b_reads_to_hid = lasagne . init . Constant ( 0.0 ) , nonlinearity = lasagne . nonlinearities . rectify , hid_init = lasagne . init . GlorotUniform ( ) , learn_init = False , **kwargs ) : #NEWLINE# #INDENT# super ( DenseController , self ) . __init__ ( incoming , memory_shape , num_units , b_reads_to_hid , hid_init , learn_init , ** kwargs ) #NEWLINE# self . nonlinearity = ( lasagne . nonlinearities . identity if ( nonlinearity is None ) else nonlinearity ) #NEWLINE# def add_weight_and_bias_params( input_dim , W , b , name ) : #NEWLINE# #INDENT# return ( self . add_param ( W , ( input_dim , self . num_units ) , name = 'W_{}' . format ( name ) ) , ( self . add_param ( b , ( self . num_units , ) , name = 'b_{}' . format ( name ) ) if ( b is not None ) else None ) ) #NEWLINE# #UNINDENT# num_inputs = int ( np . prod ( self . input_shape [ 2 : ] ) ) #NEWLINE# ( self . W_in_to_hid , self . b_in_to_hid ) = add_weight_and_bias_params ( num_inputs , W_in_to_hid , b_in_to_hid , name = 'in_to_hid' ) #NEWLINE# ( self . W_reads_to_hid , self . b_reads_to_hid ) = add_weight_and_bias_params ( ( self . num_reads * self . memory_shape [ 1 ] ) , W_reads_to_hid , b_reads_to_hid , name = 'reads_to_hid' )