code: def train(net, epoch, device, data_loader, optimizer, criterion):
      print("\nEpoch: %d" % epoch)
      net.train()
      train_loss = 0
      correct = 0
      total = 0
      for batch_idx, (inputs, targets) in enumerate(data_loader):
          inputs, targets = inputs.to(device), targets.to(device)
          optimizer.zero_grad()
          outputs = net(inputs)
          loss = criterion(outputs, targets)
          loss.backward()
          optimizer.step()
  
          train_loss += loss.item()
          _, predicted = outputs.max(1)
          total += targets.size(0)
          correct += predicted.eq(targets).sum().item()
  
      accuracy = 100.0 * correct / total
      print("train acc %.3f" % accuracy)
  
      return accuracy
  
file_path: AdaBound/demos/cifar10/main.py
imports: from __future__ import print_function
  import torch.optim
  import torch.backends.cudnn
  import torchvision
  import torchvision.transforms
  import os
  import argparse
  from models import *
  from adabound import AdaBound
label_desc: Use image node_id 7 for calling a global function with example usage: train(net, epoch, device, data_loader, optimizer, criterion) and returns: accuracy