code: def setup(args):
      opts = args.__dict__.copy()
  
      cudnn.benchmark = False
      cudnn.deterministic = True
  
      # Seed
      if opts["seed"] is None:
          opts["seed"] = random.randint(1, 10000)
      random.seed(opts["seed"])
      torch.manual_seed(opts["seed"])
  
      # Dataset
      from configure import dataset_based_configure
  
      opts = dataset_based_configure(opts)
  
      assert (
          opts["path_to_dataset"] is not None
      ), "Expect path to dataset to be set."
      if not os.path.exists(opts["path_to_dataset"]):
          if opts["dataset"] == "cycles":
              from cycles import generate_dataset
  
              generate_dataset(
                  opts["min_size"],
                  opts["max_size"],
                  opts["ds_size"],
                  opts["path_to_dataset"],
              )
          else:
              raise ValueError(
                  "Unsupported dataset: {}".format(opts["dataset"])
              )
  
      # Optimization
      if opts["clip_grad"]:
          assert (
              opts["clip_grad"] is not None
          ), "Expect the gradient norm constraint to be set."
  
      # Log
      print("Prepare logging directory...")
      log_dir = setup_log_dir(opts)
      opts["log_dir"] = log_dir
      mkdir_p(log_dir + "/samples")
  
      plt.switch_backend("Agg")
  
      save_arg_dict(opts)
      pprint(opts)
  
      return opts
  
file_path: dgl/examples/pytorch/dgmg/utils.py
imports: import datetime
  import os
  import random
  from pprint import pprint
  import matplotlib.pyplot
  import torch
  import torch.backends.cudnn
  import torch.nn
  import torch.nn.init
label_desc: Use image node_id 5 for calling a global function with example usage: setup(args) and returns: opts