code: def trainer(model, optimizer, criterion):
      # training the model
      model.train()
      for data, target in train_loader:
          data, target = data.to(device), target.to(device)
          optimizer.zero_grad()
          output = model(data)
          loss = criterion(output, target)
          loss.backward()
          optimizer.step()
  
file_path: nni/nni_assets/compression/mnist_model.py
imports: from pathlib import Path
  import torch
  from torch import nn
  from torch.nn import functional
  from torchvision import datasets, transforms
label_desc: Use image node_id 1 for calling a global function with example usage: trainer(model, optimizer, criterion) without return types