code: def create_pytorch_evaluator(
      model: torch.nn.Module,
  ) -> TorchEvaluator:
      optimizer = nni.trace(torch.optim.SGD)(
          model.parameters(), lr=0.01, momentum=0.9, weight_decay=5e-4
      )
      lr_scheduler = nni.trace(ExponentialLR)(optimizer, 0.1)
      evaluator = TorchEvaluator(
          training_model,
          optimizer,
          training_step,
          lr_scheduler,
          dummy_input=torch.rand(8, 1, 28, 28, device=device),
          evaluating_func=evaluating_model,
      )
      return evaluator
  
file_path: nni/test/algo/compression/assets/simple_mnist/simple_evaluator.py
imports: from __future__ import annotations
  from pathlib import Path
  import torch
  from torch.optim.lr_scheduler import ExponentialLR
  import pytorch_lightning
  from pytorch_lightning.loggers import TensorBoardLogger
  import nni
  from nni.compression.utils import LightningEvaluator, TorchEvaluator
  from .simple_torch_model import training_model, evaluating_model, training_step
  from .simple_lightning_model import MNISTDataModule
  from ..common import device
label_desc: Use image node_id 2 for calling a global function with example usage: create_pytorch_evaluator(model) and returns: evaluator