#NEWLINE# def perform( self , node , inputs , output_storage ) : #NEWLINE# #INDENT# ( all_states , all_weights ) = inputs #NEWLINE# all_costs = [ ] #NEWLINE# for ( states , weights ) in zip ( self , all_weights ) : #NEWLINE# #INDENT# states_dict = dict ( zip ( states , weights ) ) #NEWLINE# del states_dict [ NOT_STATE ] #NEWLINE# costs = ( numpy . ones ( len ( self . remap_table ) , dtype = theano . config . floatX ) * self . no_transition_cost ) #NEWLINE# if states_dict : #NEWLINE# #INDENT# total_weight = self . fst . combine_weights ( * states_dict . values ( ) ) #NEWLINE# for ( nn_character , fst_character ) in self . remap_table . items ( ) : #NEWLINE# #INDENT# next_states_dict = self . fst . transition ( states_dict , fst_character ) #NEWLINE# next_states_dict = self . fst . expand ( next_states_dict ) #NEWLINE# if next_states_dict : #NEWLINE# #INDENT# next_total_weight = self . fst . combine_weights ( * next_states_dict . values ( ) ) #NEWLINE# costs [ nn_character ] = ( next_total_weight - total_weight ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# all_costs . append ( costs ) #NEWLINE# #UNINDENT# output_storage [ 0 ] [ 0 ] = numpy . array ( all_costs )