class_docstr: Example of LightningModule for MNIST classification.
  
  A LightningModule organizes your PyTorch code into 5 sections:
      - Computations (init).
      - Train loop (training_step)
      - Validation loop (validation_step)
      - Test loop (test_step)
      - Optimizers (configure_optimizers)
  
  Read the docs:
      https://pytorch-lightning.readthedocs.io/en/latest/common/lightning_module.html
class_docstr_tok: ["Example","of","LightningModule","for","MNIST","classification",".","A","LightningModule","organizes","your","PyTorch","code","into","5","sections",":","-","Computations","(","init",")",".","-","Train","loop","(","training_step",")","-","Validation","loop","(","validation_step",")","-","Test","loop","(","test_step",")","-","Optimizers","(","configure_optimizers",")","Read","the","docs",":","https",":","\/\/pytorch-lightning.readthedocs.io\/en\/latest\/common\/lightning_module.html"]
code: def validation_step(self, batch: Any, batch_idx: int):
      loss, preds, targets = self.step(batch)
  
      # log val metrics
      acc = self.val_accuracy(preds, targets)
      self.log(
          "val/loss", loss, on_step=False, on_epoch=True, prog_bar=False
      )
      self.log(
          "val/acc", acc, on_step=False, on_epoch=True, prog_bar=True
      )
  
      return {"loss": loss, "preds": preds, "targets": targets}
  
file_path: zoo/src/models/mnist_model.py
imports: from typing import Any, List
  import torch
  from pytorch_lightning import LightningModule
  from torchmetrics.classification.accuracy import Accuracy
  from src.models.modules.simple_dense_net import SimpleDenseNet
label_desc: Use image node_id 6 for calling the MNISTLitModel obj's underlying member method code with example usage: obj.validation_step(batch, batch_idx) and returns: dict