class_docstr: Hooks to be used in LightningModule.
class_docstr_tok: ["Hooks","to","be","used","in","LightningModule","."]
docstr: Called by the training loop to release gradients before entering the validation loop.
code: def on_validation_model_zero_grad(self) -> None:
      """Called by the training loop to release gradients before entering the validation loop."""
      zero_grad_kwargs = (
          {} if _TORCH_GREATER_EQUAL_2_0 else {"set_to_none": True}
      )
      self.zero_grad(**zero_grad_kwargs)
  
imports: from typing import Any, Dict, Optional
  import torch
  from torch import Tensor
  from torch.optim.optimizer import Optimizer
  from lightning.fabric.utilities.imports import _TORCH_GREATER_EQUAL_2_0
  from lightning.pytorch.utilities import move_data_to_device
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.types import EVAL_DATALOADERS, STEP_OUTPUT, TRAIN_DATALOADERS
label_desc: Use image node_id 19 for calling the ModelHooks obj's underlying member method code with example usage: obj.on_validation_model_zero_grad() without return types