#NEWLINE# def _backwardImplementation( self , outerr , inerr , outbuf , inbuf ) : #NEWLINE# #INDENT# assert ( not self . forget ) , 'Cannot back propagate a forgetful network' #NEWLINE# assert self . sorted , '.sortModules() has not been called' #NEWLINE# index = 0 #NEWLINE# offset = self . offset #NEWLINE# for m in self . outmodules : #NEWLINE# #INDENT# m . outputerror [ offset ] = outerr [ index : ( outbuf + m . outdim ) ] #NEWLINE# index += m . outdim #NEWLINE# #UNINDENT# if ( not self . _isLastTimestep ( ) ) : #NEWLINE# #INDENT# for c in self . recurrentConns : #NEWLINE# #INDENT# c . backward ( offset , ( offset + 1 ) ) #NEWLINE# #UNINDENT# #UNINDENT# for m in reversed ( self . modulesSorted ) : #NEWLINE# #INDENT# for c in self . connections [ m ] : #NEWLINE# #INDENT# c . backward ( offset , offset ) #NEWLINE# #UNINDENT# m . offset = offset #NEWLINE# m . backward ( ) #NEWLINE# #UNINDENT# index = 0 #NEWLINE# for m in self . inmodules : #NEWLINE# #INDENT# inerr [ index : ( index + m . indim ) ] = m . inputerror [ offset ] #NEWLINE# index += m . indim