code: def prepare(args):
      global trainloader
      global testloader
      global net
      global criterion
      global optimizer
  
      # Data
      print("==> Preparing data..")
      transform_train = transforms.Compose(
          [
              transforms.RandomCrop(32, padding=4),
              transforms.RandomHorizontalFlip(),
              transforms.ToTensor(),
              transforms.Normalize(
                  (0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)
              ),
          ]
      )
  
      transform_test = transforms.Compose(
          [
              transforms.ToTensor(),
              transforms.Normalize(
                  (0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)
              ),
          ]
      )
  
      trainset = torchvision.datasets.CIFAR10(
          root="./data",
          train=True,
          download=True,
          transform=transform_train,
      )
      trainloader = torch.utils.data.DataLoader(
          trainset, batch_size=128, shuffle=True, num_workers=2
      )
  
      testset = torchvision.datasets.CIFAR10(
          root="./data",
          train=False,
          download=True,
          transform=transform_test,
      )
      testloader = torch.utils.data.DataLoader(
          testset, batch_size=100, shuffle=False, num_workers=2
      )
  
      # classes = ('plane', 'car', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck')
  
      # Model
      print("==> Building model..")
      if args["model"] == "vgg":
          net = VGG("VGG19")
      if args["model"] == "resnet18":
          net = ResNet18()
      if args["model"] == "googlenet":
          net = GoogLeNet()
      if args["model"] == "densenet121":
          net = DenseNet121()
      if args["model"] == "mobilenet":
          net = MobileNet()
      if args["model"] == "dpn92":
          net = DPN92()
      if args["model"] == "shufflenetg2":
          net = ShuffleNetG2()
      if args["model"] == "senet18":
          net = SENet18()
  
      net = net.to(device)
      if device == "cuda":
          net = torch.nn.DataParallel(net)
          cudnn.benchmark = True
  
      criterion = nn.CrossEntropyLoss()
      # optimizer = optim.SGD(net.parameters(), lr=args['lr'], momentum=0.9, weight_decay=5e-4)
  
      if args["optimizer"] == "SGD":
          optimizer = optim.SGD(
              net.parameters(),
              lr=args["lr"],
              momentum=0.9,
              weight_decay=5e-4,
          )
      if args["optimizer"] == "Adadelta":
          optimizer = optim.Adadelta(net.parameters(), lr=args["lr"])
      if args["optimizer"] == "Adagrad":
          optimizer = optim.Adagrad(net.parameters(), lr=args["lr"])
      if args["optimizer"] == "Adam":
          optimizer = optim.Adam(net.parameters(), lr=args["lr"])
      if args["optimizer"] == "Adamax":
          optimizer = optim.Adam(net.parameters(), lr=args["lr"])
  
file_path: nni/examples/trials/cifar10_pytorch/main.py
imports: from __future__ import print_function
  import argparse
  import torch
  import torch.nn
  import torch.optim
  import torch.nn.functional
  import torch.backends.cudnn
  import torchvision
  import torchvision.transforms
  import os
  import argparse
  import logging
  from models import *
  from utils import progress_bar
  import nni
label_desc: Use image node_id 1 for calling a global function with example usage: prepare(args) without return types