#NEWLINE# def add_layer( self , layer ) : #NEWLINE# #INDENT# prev_layer_dim = 0 #NEWLINE# if ( len ( self . layers ) == 0 ) : #NEWLINE# #INDENT# prev_layer_dim = self . input_dim #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# prev_layer_dim = self . layers [ ( - 1 ) ] . dim #NEWLINE# #UNINDENT# if ( layer . W is None ) : #NEWLINE# #INDENT# W_values = np . asarray ( np . random . normal ( loc = 0 , scale = 0.1 , size = ( prev_layer_dim , layer . dim ) ) , dtype = floatX ) #NEWLINE# layer . W = theano . shared ( value = W_values , name = ( 'W_' + layer . name ) , borrow = True ) #NEWLINE# #UNINDENT# if ( layer . b is None ) : #NEWLINE# #INDENT# layer . b = theano . shared ( np . zeros ( layer . dim , dtype = floatX ) , name = ( 'b_' + layer . name ) , borrow = True ) #NEWLINE# #UNINDENT# self . layers . append ( layer )