#NEWLINE# def fprop( self , inputs , inference = False ) : #NEWLINE# #INDENT# '\n        Apply the forward pass transformation to the input data.\n\n        Arguments:\n            inputs (list): list of Tensors with one such tensor for each time\n                           step of model unrolling.\n            inference (bool, optional): Set to true if you are running\n                                        inference (only care about forward\n                                        propagation without associated backward\n                                        propagation).  Default is False.\n\n        Returns:\n            Tensor: LSTM output for each model time step\n        ' #NEWLINE# self . init_buffers ( inputs ) #NEWLINE# if self . reset_cells : #NEWLINE# #INDENT# self . h_f [ ( - 1 ) ] [ : ] = 0 #NEWLINE# self . c_f [ ( - 1 ) ] [ : ] = 0 #NEWLINE# self . h_b [ 0 ] [ : ] = 0 #NEWLINE# self . c_b [ 0 ] [ : ] = 0 #NEWLINE# #UNINDENT# params_f = ( self . h_f , self . h_prev , self . xs_f , self . ifog_f , self . ifo_f , self . i_f , self . f_f , self . o_f , self . g_f , self . c_f , self . c_prev , self . c_act_f ) #NEWLINE# params_b = ( self . h_b , self . h_next , self . xs_b , self . ifog_b , self . ifo_b , self . i_b , self . f_b , self . o_b , self . g_b , self . c_b , self . c_next , self . c_act_b ) #NEWLINE# for ( h , h_prev , xs , ifog , ifo , i , f , o , g , c , c_prev , c_act ) in zip ( * params_f ) : #NEWLINE# #INDENT# self . be . compound_dot ( self . W_recur_f , h_prev , ifog ) #NEWLINE# self . be . compound_dot ( self . W_input_f , xs , ifog , beta = 1.0 ) #NEWLINE# ifog [ : ] = ( ifog + self . b_f ) #NEWLINE# ifo [ : ] = self . gate_activation ( ifo ) #NEWLINE# g [ : ] = self . activation ( g ) #NEWLINE# c [ : ] = ( ( f * c_prev ) + ( i * g ) ) #NEWLINE# c_act [ : ] = self . activation ( c ) #NEWLINE# h [ : ] = ( o * c_act ) #NEWLINE# #UNINDENT# for ( h , h_next , xs , ifog , ifo , i , f , o , g , c , c_next , c_act ) in reversed ( zip ( * params_b ) ) : #NEWLINE# #INDENT# self . be . compound_dot ( self . W_recur_b , h_next , ifog ) #NEWLINE# self . be . compound_dot ( self . W_input_b , xs , ifog , beta = 1.0 ) #NEWLINE# ifog [ : ] = ( ifog + self . b_b ) #NEWLINE# ifo [ : ] = self . gate_activation ( ifo ) #NEWLINE# g [ : ] = self . activation ( g ) #NEWLINE# c [ : ] = ( ( f * c_next ) + ( i * g ) ) #NEWLINE# c_act [ : ] = self . activation ( c ) #NEWLINE# h [ : ] = ( o * c_act ) #NEWLINE# #UNINDENT# return self . h_buffer