class_docstr: Performs automatic optimization (forward, zero grad, backward, optimizer step)
docstr: Zeroes out all gradients of parameters optimized by the current optimizer.
  
  Args:
      batch_idx: the index of the current batch
      optimizer: the current optimizer
code: def _optimizer_zero_grad(
      self, batch_idx: int, optimizer: torch.optim.Optimizer
  ) -> None:
      """Zeroes out all gradients of parameters optimized by the current optimizer.
  
      Args:
          batch_idx: the index of the current batch
          optimizer: the current optimizer
  
      """
      trainer = self.trainer
      call._call_lightning_module_hook(
          trainer,
          "optimizer_zero_grad",
          trainer.current_epoch,
          batch_idx,
          optimizer,
      )
      self.optim_progress.optimizer.zero_grad.increment_completed()
  
imports: from dataclasses import dataclass, field
  from functools import partial
  from typing import Any, Callable, Dict, Mapping, Optional, OrderedDict
  import torch
  from torch import Tensor
  from torch.optim import Optimizer
  from typing_extensions import override
  import lightning.pytorch
  from lightning.pytorch.loops.loop import _Loop
  from lightning.pytorch.loops.optimization.closure import AbstractClosure, OutputResult
  from lightning.pytorch.loops.progress import _OptimizationProgress
  from lightning.pytorch.loops.utilities import _block_parallel_sync_behavior
  from lightning.pytorch.trainer import call
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.rank_zero import WarningCache
  from lightning.pytorch.utilities.types import STEP_OUTPUT
label_desc: Use image node_id 9 for calling the _AutomaticOptimization obj's underlying member method code with example usage: obj._optimizer_zero_grad(batch_idx, optimizer) without return types