class_docstr: A common LightningModule implementation of a image classifier.
class_docstr_tok: ["A","common","LightningModule","implementation","of","a","image","classifier","."]
docstr: A test step of a ImageClassifier.
docstr_tok: ["A","test","step","of","a","ImageClassifier","."]
code: def test_step(self, batch, batch_idx):
      """A test step of a ImageClassifier."""
      x, y = batch
      output = self.forward(x)
      loss = self.criterion(output, y)
      pred = torch.argmax(output, dim=1)
      acc = torch.sum(y == pred).item() / (len(y) * 1.0)
      metrics = {"test_acc": acc, "test_loss": loss}
      self.log_dict(metrics)
  
file_path: BigDL/python/nano/src/bigdl/nano/pytorch/vision/models/classifier.py
imports: from typing import Callable
  import pytorch_lightning
  import torch
  import torch.nn
  from ._utils import BackboneModule
label_desc: Use image node_id 4 for calling the ImageClassifier obj's underlying member method code with example usage: obj.test_step(batch, batch_idx) without return types