#NEWLINE# def _buildCaptureNetwork( self ) : #NEWLINE# #INDENT# inmod = LinearLayer ( ( ( self . insize * self . size ) * self . size ) , name = 'input' ) #NEWLINE# inmesh = ModuleMesh . viewOnFlatLayer ( inmod , ( self . size , self . size ) , 'inmesh' ) #NEWLINE# outmod = self . outcomponentclass ( ( ( self . outputs * self . size ) * self . size ) , name = 'output' ) #NEWLINE# outmesh = ModuleMesh . viewOnFlatLayer ( outmod , ( self . size , c . size ) , 'outmesh' ) #NEWLINE# if ( self . componentclass is MDLSTMLayer ) : #NEWLINE# #INDENT# c = ( lambda : MDLSTMLayer ( self . hsize , 2 , self . peepholes ) . meatSlice ( ) ) #NEWLINE# hiddenmesh = ModuleMesh ( c , ( self . size , self . size , 4 ) , 'hidden' , baserename = True ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# hiddenmesh = ModuleMesh . constructWithLayers ( self . componentclass , self . hsize , ( self . size , self . size , 4 ) , 'hidden' ) #NEWLINE# #UNINDENT# self . _buildBorderStructure ( inmesh , hiddenmesh , outmesh ) #NEWLINE# for m in self . modules : #NEWLINE# #INDENT# if isinstance ( m , MDLSTMLayer ) : #NEWLINE# #INDENT# tmp = m . stateSlice ( ) #NEWLINE# index = 0 #NEWLINE# for c in list ( self . connections [ m ] ) : #NEWLINE# #INDENT# if isinstance ( c . outmod , MDLSTMLayer ) : #NEWLINE# #INDENT# self . addConnection ( IdentityConnection ( tmp , c . outmod . stateSlice ( ) , outSliceFrom = ( self . hsize * index ) , outSliceTo = ( self . hsize * ( index + 1 ) ) ) ) #NEWLINE# index += 1 #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if self . directlink : #NEWLINE# #INDENT# self . _buildDirectLink ( inmesh , outmesh ) #NEWLINE# #UNINDENT# if ( self . combinputs > 0 ) : #NEWLINE# #INDENT# cin = LinearLayer ( self . combinputs , name = 'globalin' ) #NEWLINE# self . addInputModule ( cin ) #NEWLINE# if ( 'globalinconn' not in self . predefined ) : #NEWLINE# #INDENT# self . predefined [ 'globalinconn' ] = MotherConnection ( ( cin . componentOutdim * hiddenmesh . componentIndim ) , 'globalinconn' ) #NEWLINE# #UNINDENT# self . _linkToAll ( cin , hiddenmesh , self . predefined [ 'globalinconn' ] )