code: def _apply_nesterov(r, t, x, g, v, norm_coefficient, alpha, beta):  # type: ignore
      # Add gradient of regularization term.
      g_regularized = norm_coefficient * x + g
      # Coefficient of gradient should be 1 at the first iteration.
      beta_adjusted = beta if t > 0 else 1
      # Update momentum.
      v_new = alpha * v + beta_adjusted * g_regularized
      # Apply Nesterov with momentum update rule.
      x_new = x - r * (g_regularized + alpha * v_new)
      return x_new, v_new
  
imports: from onnx.reference.ops.aionnx_preview_training._op_run_training import OpRunTraining
label_desc: Use image node_id 2 for calling a global function with example usage: _apply_nesterov(r, t, x, g, v, norm_coefficient, alpha, beta) and returns: x_new,  v_new