code: def train_epoch(model, device, train_loader, optimizer, epoch):
      loss_fn = torch.nn.CrossEntropyLoss()
      model.train()
      for batch_idx, (data, target) in enumerate(train_loader):
          data, target = data.to(device), target.to(device)
          optimizer.zero_grad()
          output = model(data)
          loss = loss_fn(output, target)
          loss.backward()
          optimizer.step()
          if batch_idx % 10 == 0:
              print(
                  "Train Epoch: {} [{}/{} ({:.0f}%)]\tLoss: {:.6f}".format(
                      epoch,
                      batch_idx * len(data),
                      len(train_loader.dataset),
                      100.0 * batch_idx / len(train_loader),
                      loss.item(),
                  )
              )
  
imports: import os
  import random
  from pathlib import Path
  import nni
  import torch
  import torch.nn.functional
  import nni.retiarii.nn.pytorch
  import nni.retiarii.strategy
  from nni.retiarii import model_wrapper
  from nni.retiarii.evaluator import FunctionalEvaluator
  from nni.retiarii.experiment.pytorch import RetiariiExeConfig, RetiariiExperiment, debug_mutated_model
  from torch.utils.data import DataLoader
  from torchvision import transforms
  from torchvision.datasets import MNIST
label_desc: Use image node_id 1 for calling a global function with example usage: train_epoch(model, device, train_loader, optimizer, epoch) without return types