parameters: (self,args,**kwargs)
docstring: Evaluates the generalized derivative of this computation graph with 
          respect to the named variables in args, at the given settings in
          kwargs.
  
          Examples:
  
          - ``(var('x')**3).gen_derivative(['x','x'])`` returns the
             second derivative of :math:`x^3` with respect to x. 
          - ``var('x')**2*var('y').gen_derivative(['x','y'])`` returns
             :math:`\\frac{d^2}{dx dy} x^2 y`.
  
          If args is [], this is equivalent to ``self.eval(**kwargs)``.
  
          If args has only one element, this is equivalent to
          ``self.derivative(args[0],**kwargs)``.
  
          Args:
              args (list of str): the denominators of the derivative to be
                  evaluated.
              kwargs (dict): the values at which the derivative is evaluated.
  
          Result:
              ndarray: A tensor of shape
              ``(_size(this),_size(args[0]),...,_size(args[-1]))`` containing
              the derivatives.
docstring_summary: Evaluates the generalized derivative of this computation graph with 
          respect to the named variables in args, at the given settings in
          kwargs.
docstring_tokens: Evaluates the generalized derivative of this computation graph with respect to the named variables in args at the given settings in kwargs .
function: def gen_derivative(self,args,**kwargs):
          """Evaluates the generalized derivative of this computation graph with 
          respect to the named variables in args, at the given settings in
          kwargs.
  
          Examples:
  
          - ``(var('x')**3).gen_derivative(['x','x'])`` returns the
             second derivative of :math:`x^3` with respect to x. 
          - ``var('x')**2*var('y').gen_derivative(['x','y'])`` returns
             :math:`\\frac{d^2}{dx dy} x^2 y`.
  
          If args is [], this is equivalent to ``self.eval(**kwargs)``.
  
          If args has only one element, this is equivalent to
          ``self.derivative(args[0],**kwargs)``.
  
          Args:
              args (list of str): the denominators of the derivative to be
                  evaluated.
              kwargs (dict): the values at which the derivative is evaluated.
  
          Result:
              ndarray: A tensor of shape
              ``(_size(this),_size(args[0]),...,_size(args[-1]))`` containing
              the derivatives.
          """
          if len(args)==0:
              return self.eval(**kwargs)
          elif len(args)==1:
              return self.derivative(args[0],**kwargs)
          elif len(args)==2:
              if 'eval_context' not in self._cache or not _context_equal(self._cache['eval_context'],kwargs):
                  self.eval(**kwargs)
                  assert _context_equal(self._cache['eval_context'],kwargs)
              self._clear_cache('hessian_result','deriv_darg1','deriv_darg2')
              self.derivative(args[0],**kwargs)
              self._move_cache('deriv_result','deriv_darg1')
              self.derivative(args[1],**kwargs)
              self._move_cache('deriv_result','deriv_darg2')
              res = self._hessian([],args[0],args[1],kwargs)
              hess_shape = (_size(self._cache['eval_result']),)+tuple(_size(kwargs[arg]) for arg in args)
              if res is 0:
                  return np.zeros(hess_shape)
              return res
          else:
              raise NotImplementedError("TODO: higher-order derivatives")
function_tokens: def gen_derivative ( self , args , * * kwargs ) : if len ( args ) == 0 : return self . eval ( * * kwargs ) elif len ( args ) == 1 : return self . derivative ( args [ 0 ] , * * kwargs ) elif len ( args ) == 2 : if 'eval_context' not in self . _cache or not _context_equal ( self . _cache [ 'eval_context' ] , kwargs ) : self . eval ( * * kwargs ) assert _context_equal ( self . _cache [ 'eval_context' ] , kwargs ) self . _clear_cache ( 'hessian_result' , 'deriv_darg1' , 'deriv_darg2' ) self . derivative ( args [ 0 ] , * * kwargs ) self . _move_cache ( 'deriv_result' , 'deriv_darg1' ) self . derivative ( args [ 1 ] , * * kwargs ) self . _move_cache ( 'deriv_result' , 'deriv_darg2' ) res = self . _hessian ( [ ] , args [ 0 ] , args [ 1 ] , kwargs ) hess_shape = ( _size ( self . _cache [ 'eval_result' ] ) , ) + tuple ( _size ( kwargs [ arg ] ) for arg in args ) if res is 0 : return np . zeros ( hess_shape ) return res else : raise NotImplementedError ( "TODO: higher-order derivatives" )