code: def get_config(model):
      nr_tower = max(get_num_gpu(), 1)
      assert args.batch % nr_tower == 0
      batch = args.batch // nr_tower
  
      logger.info(
          "Running on {} towers. Batch size per tower: {}".format(
              nr_tower, batch
          )
      )
      if batch < 32 or batch > 64:
          logger.warn(
              "Batch size per tower not in [32, 64]. This probably will lead to worse accuracy than reported."
          )
      if args.fake:
          data = QueueInput(
              FakeData(
                  [[batch, 224, 224, 3], [batch]],
                  1000,
                  random=False,
                  dtype="uint8",
              )
          )
          callbacks = []
      else:
          if args.symbolic:
              data = TFDatasetInput(
                  get_imagenet_tfdata(args.data, "train", batch)
              )
          else:
              data = QueueInput(
                  get_imagenet_dataflow(args.data, "train", batch)
              )
  
          START_LR = 0.1
          BASE_LR = START_LR * (args.batch / 256.0)
          callbacks = [
              ModelSaver(),
              EstimatedTimeLeft(),
              ScheduledHyperParamSetter(
                  "learning_rate",
                  [
                      (0, min(START_LR, BASE_LR)),
                      (30, BASE_LR * 1e-1),
                      (60, BASE_LR * 1e-2),
                      (90, BASE_LR * 1e-3),
                      (100, BASE_LR * 1e-4),
                  ],
              ),
          ]
          if BASE_LR > START_LR:
              callbacks.append(
                  ScheduledHyperParamSetter(
                      "learning_rate",
                      [(0, START_LR), (5, BASE_LR)],
                      interp="linear",
                  )
              )
  
          infs = [
              ClassificationError("wrong-top1", "val-error-top1"),
              ClassificationError("wrong-top5", "val-error-top5"),
          ]
          dataset_val = get_imagenet_dataflow(args.data, "val", batch)
          if nr_tower == 1:
              # single-GPU inference with queue prefetch
              callbacks.append(
                  InferenceRunner(QueueInput(dataset_val), infs)
              )
          else:
              # multi-GPU inference (with mandatory queue prefetch)
              callbacks.append(
                  DataParallelInferenceRunner(
                      dataset_val, infs, list(range(nr_tower))
                  )
              )
  
      if get_num_gpu() > 0:
          callbacks.append(GPUUtilizationTracker())
  
      return TrainConfig(
          model=model,
          data=data,
          callbacks=callbacks,
          steps_per_epoch=100 if args.fake else 1281167 // args.batch,
          max_epoch=105,
      )
  
file_path: tensorpack/examples/ResNet/imagenet-resnet.py
imports: import argparse
  import os
  from tensorpack import QueueInput, TFDatasetInput, logger
  from tensorpack.callbacks import *
  from tensorpack.dataflow import FakeData
  from tensorpack.models import *
  from tensorpack.tfutils import argscope, SmartInit
  from tensorpack.train import SyncMultiGPUTrainerReplicated, TrainConfig, launch_train_with_config
  from tensorpack.utils.gpu import get_num_gpu
  from imagenet_utils import ImageNetModel, eval_classification, get_imagenet_dataflow, get_imagenet_tfdata
  import resnet_model
  from resnet_model import preact_group, resnet_backbone, resnet_group
label_desc: Use image node_id 1 for calling a global function with example usage: get_config(model) and returns: TrainConfig