code: def train(epoch):
      network.train()
      for batch_idx, (data, target) in enumerate(train_loader):
          optimizer.zero_grad()
          output = network(data)
          loss = loss_func(output, target)
          loss.backward()
          optimizer.step()
          if batch_idx % log_interval == 0:
              print(
                  "Train Epoch: {} [{}/{} ({:.0f}%)]\tLoss: {:.6f}".format(
                      epoch,
                      batch_idx * len(data),
                      len(train_loader.dataset),
                      old_div(100.0 * batch_idx, len(train_loader)),
                      loss.item(),
                  )
              )
              train_losses.append(loss.item())
              train_counter.append(
                  (batch_idx * 64)
                  + ((epoch - 1) * len(train_loader.dataset))
              )
              torch.save(network.state_dict(), "./results/model.pth")
              torch.save(
                  optimizer.state_dict(), "./results/optimizer.pth"
              )
  
file_path: AdvBox/DataPoison/poison_mnist_pytorch.py
imports: from __future__ import division
  from __future__ import print_function
  from builtins import range
  from past.utils import old_div
  import torch
  import torchvision
  import torch.nn
  import torch.nn.functional
  import torch.optim
label_desc: Use image node_id 1 for calling a global function with example usage: train(epoch) without return types