code: def get_config(cifar_classnum):
      # prepare dataset
      dataset_train = get_data("train", cifar_classnum)
      dataset_test = get_data("test", cifar_classnum)
  
      def lr_func(lr):
          if lr < 3e-5:
              raise StopTraining()
          return lr * 0.31
  
      return TrainConfig(
          model=Model(cifar_classnum),
          data=QueueInput(dataset_train),
          callbacks=[
              ModelSaver(),
              InferenceRunner(
                  dataset_test, ScalarStats(["accuracy", "cost"])
              ),
              StatMonitorParamSetter(
                  "learning_rate",
                  "validation_accuracy",
                  lr_func,
                  threshold=0.001,
                  last_k=10,
                  reverse=True,
              ),
          ],
          max_epoch=150,
      )
  
file_path: tensorpack/examples/basics/cifar-convnet.py
imports: import argparse
  import os
  from tensorpack import tfv1
  from tensorpack import *
  from tensorpack.dataflow import dataset
  from tensorpack.tfutils.summary import *
  from tensorpack.utils.gpu import get_num_gpu
label_desc: Use image node_id 2 for calling a global function with example usage: get_config(cifar_classnum) and returns: TrainConfig, unknown