code: def compute_grad(
      self, objective_fn, args, kwargs, grad_fn=None
  ):  # pylint: disable=arguments-renamed
      r"""Compute gradient of the objective function at at the shifted point :math:`(x -
      m\times\text{accumulation})` and return it along with the objective function forward pass
      (if available).
  
      Args:
          objective_fn (function): the objective function for optimization.
          args (tuple): tuple of NumPy arrays containing the current values for the
              objection function.
          kwargs (dict): keyword arguments for the objective function.
          grad_fn (function): optional gradient function of the objective function with respect to
              the variables ``x``. If ``None``, the gradient function is computed automatically.
              Must return the same shape of tuple [array] as the autograd derivative.
  
      Returns:
          tuple [array]: the NumPy array containing the gradient :math:`\nabla f(x^{(t)})` and the
          objective function output. If ``grad_fn`` is provided, the objective function
          will not be evaluted and instead ``None`` will be returned.
      """
      shifted_args = list(args)
  
      trainable_indices = [
          i
          for i, arg in enumerate(args)
          if getattr(arg, "requires_grad", False)
      ]
  
      if self.accumulation:
          for index in trainable_indices:
              shifted_args[index] = (
                  args[index] - self.momentum * self.accumulation[index]
              )
  
      g = get_gradient(objective_fn) if grad_fn is None else grad_fn
      grad = g(*shifted_args, **kwargs)
      forward = getattr(g, "forward", None)
  
      grad = (grad,) if len(trainable_indices) == 1 else grad
      return grad, forward
  
imports: from pennylane._grad import grad
  from .momentum import MomentumOptimizer
label_desc: Use image node_id 1 for calling the NesterovMomentumOptimizer obj's underlying member method code with example usage: obj.compute_grad(objective_fn, args, kwargs, grad_fn) and returns: grad,  forward