class_docstr: A generic LightningMoudle for light-weight HPO.
docstr: Define a single validation step.
docstr_tok: ["Define","a","single","validation","step","."]
code: def validation_step(self, batch, batch_idx):
      """Define a single validation step."""
      y_hat = self(*batch)
      if self.loss:
          loss = self.loss(
              y_hat, batch[-1]
          )  # use last output as target
          self.log(
              "val/loss",
              loss,
              on_epoch=True,
              prog_bar=True,
              logger=True,
          )
      if self.metrics:
          acc = {
              _format_metric("val", metric, i): metric(y_hat, batch[-1])
              for i, metric in enumerate(self.metrics)
          }
          self.log_dict(acc, on_epoch=True, prog_bar=True, logger=True)
  
imports: from bigdl.nano.pytorch.lightning import LightningModule
  from bigdl.nano.utils.common import invalidInputError
  from typing import List
  import pytorch_lightning
  from torchmetrics.metric import Metric
  from torch.optim.lr_scheduler import _LRScheduler
  import bigdl.nano.automl.hpo
  import warnings
  import torch
  import inspect
  from torch import nn, Tensor, fx
  from torch.utils.data import TensorDataset, DataLoader
  from bigdl.nano.automl.hpo.space import Space
label_desc: Use image node_id 3 for calling the GenericLightningModule obj's underlying member method code with example usage: obj.validation_step(batch, batch_idx) without return types