#NEWLINE# def grad( self , ins , grads ) : #NEWLINE# #INDENT# ts = ins [ 1 : ] [ : self . n_outs ] #NEWLINE# fs = ins [ 1 : ] [ self . n_outs : ] #NEWLINE# if ( self . name is not None ) : #NEWLINE# #INDENT# nw_name_t = ( self . name + '_grad_t' ) #NEWLINE# nw_name_f = ( self . name + '_grad_f' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# nw_name_t = None #NEWLINE# nw_name_f = None #NEWLINE# #UNINDENT# if_true_op = IfElse ( n_outs = self . n_outs , as_view = self . as_view , gpu = self . gpu , name = nw_name_t ) #NEWLINE# if_false_op = IfElse ( n_outs = self . n_outs , as_view = self . as_view , gpu = self . gpu , name = nw_name_f ) #NEWLINE# if_true = ( ( [ ins [ 0 ] ] + grads ) + [ theano . tensor . zeros_like ( t ) for t in ts ] ) #NEWLINE# if_false = ( ( [ ins [ 0 ] ] + [ theano . tensor . zeros_like ( if_false ) for f in fs ] ) + grads ) #NEWLINE# condition = ins [ 0 ] #NEWLINE# condition_grad = condition . zeros_like ( ) . astype ( theano . config . floatX ) #NEWLINE# return ( ( [ condition_grad ] + if_true_op ( * if_true , ** dict ( return_list = True ) ) ) + if_false_op ( * if_false , ** dict ( return_list = True ) ) )