#NEWLINE# def buildParityNet( ) : #NEWLINE# #INDENT# net = RecurrentNetwork ( ) #NEWLINE# net . addInputModule ( LinearLayer ( 1 , name = 'i' ) ) #NEWLINE# net . addModule ( TanhLayer ( 2 , name = 'h' ) ) #NEWLINE# net . addModule ( BiasUnit ( 'bias' ) ) #NEWLINE# net . addOutputModule ( TanhLayer ( 1 , name = 'o' ) ) #NEWLINE# net . addConnection ( FullConnection ( net [ 'i' ] , net [ 'h' ] ) ) #NEWLINE# net . addConnection ( FullConnection ( net [ 'bias' ] , net [ 'h' ] ) ) #NEWLINE# net . addConnection ( FullConnection ( net [ 'bias' ] , net [ 'o' ] ) ) #NEWLINE# net . addConnection ( FullConnection ( net [ 'h' ] , net [ 'o' ] ) ) #NEWLINE# net . addRecurrentConnection ( FullConnection ( net [ 'o' ] , net [ 'h' ] ) ) #NEWLINE# net . sortModules ( ) #NEWLINE# p = net . params #NEWLINE# p [ : ] = [ ( - 0.5 ) , ( - 1.5 ) , 1 , 1 , ( - 1 ) , 1 , 1 , ( - 1 ) , 1 ] #NEWLINE# p *= 10.0 #NEWLINE# return net