code: def run_mpc_cifar(
      epochs=25,
      start_epoch=0,
      batch_size=1,
      lr=0.001,
      momentum=0.9,
      weight_decay=1e-6,
      print_freq=10,
      model_location="",
      resume=False,
      evaluate=True,
      seed=None,
      skip_plaintext=False,
      context_manager=None,
  ):
      if seed is not None:
          random.seed(seed)
          torch.manual_seed(seed)
  
      crypten.init()
  
      # create model
      model = LeNet()
  
      criterion = nn.CrossEntropyLoss()
      optimizer = torch.optim.SGD(
          model.parameters(),
          lr=lr,
          momentum=momentum,
          weight_decay=weight_decay,
      )
  
      # optionally resume from a checkpoint
      best_prec1 = 0
      if resume:
          if os.path.isfile(model_location):
              logging.info(
                  "=> loading checkpoint '{}'".format(model_location)
              )
              checkpoint = torch.load(model_location)
              start_epoch = checkpoint["epoch"]
              best_prec1 = checkpoint["best_prec1"]
              model.load_state_dict(checkpoint["state_dict"])
              optimizer.load_state_dict(checkpoint["optimizer"])
              logging.info(
                  "=> loaded checkpoint '{}' (epoch {})".format(
                      model_location, checkpoint["epoch"]
                  )
              )
          else:
              raise IOError(
                  "=> no checkpoint found at '{}'".format(
                      model_location
                  )
              )
  
      # Data loading code
      def preprocess_data(context_manager, data_dirname):
          transform = transforms.Compose(
              [
                  transforms.ToTensor(),
                  transforms.Normalize(
                      (0.5, 0.5, 0.5), (0.5, 0.5, 0.5)
                  ),
              ]
          )
          with context_manager:
              trainset = datasets.CIFAR10(
                  data_dirname,
                  train=True,
                  download=True,
                  transform=transform,
              )
              testset = datasets.CIFAR10(
                  data_dirname,
                  train=False,
                  download=True,
                  transform=transform,
              )
          trainloader = torch.utils.data.DataLoader(
              trainset, batch_size=4, shuffle=True, num_workers=2
          )
          testloader = torch.utils.data.DataLoader(
              testset,
              batch_size=batch_size,
              shuffle=False,
              num_workers=2,
          )
          return trainloader, testloader
  
      if context_manager is None:
          context_manager = NoopContextManager()
  
      data_dir = tempfile.TemporaryDirectory()
      train_loader, val_loader = preprocess_data(
          context_manager, data_dir.name
      )
  
      if evaluate:
          if not skip_plaintext:
              logging.info(
                  "===== Evaluating plaintext LeNet network ====="
              )
              validate(val_loader, model, criterion, print_freq)
          logging.info("===== Evaluating Private LeNet network =====")
          input_size = get_input_size(val_loader, batch_size)
          private_model = construct_private_model(input_size, model)
          validate(val_loader, private_model, criterion, print_freq)
          # logging.info("===== Validating side-by-side ======")
          # validate_side_by_side(val_loader, model, private_model)
          return
  
      # define loss function (criterion) and optimizer
      for epoch in range(start_epoch, epochs):
          adjust_learning_rate(optimizer, epoch, lr)
  
          # train for one epoch
          train(
              train_loader,
              model,
              criterion,
              optimizer,
              epoch,
              print_freq,
          )
  
          # evaluate on validation set
          prec1 = validate(val_loader, model, criterion, print_freq)
  
          # remember best prec@1 and save checkpoint
          is_best = prec1 > best_prec1
          best_prec1 = max(prec1, best_prec1)
          save_checkpoint(
              {
                  "epoch": epoch + 1,
                  "arch": "LeNet",
                  "state_dict": model.state_dict(),
                  "best_prec1": best_prec1,
                  "optimizer": optimizer.state_dict(),
              },
              is_best,
          )
      data_dir.cleanup()
  
imports: import logging
  import os
  import random
  import shutil
  import tempfile
  import time
  import crypten
  import crypten.communicator
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.optim
  import torch.utils.data
  import torch.utils.data.distributed
  from examples.meters import AverageMeter
  from examples.util import NoopContextManager
  from torchvision import datasets, transforms
label_desc: Use image node_id 1 for calling a global function with example usage: run_mpc_cifar(epochs, start_epoch, batch_size, lr, momentum, weight_decay, print_freq, model_location, resume, evaluate, seed, skip_plaintext, context_manager) and returns: trainloader,  testloader