code: def build_transform_gen(cfg, is_train):
      """
      Create a list of :class:`TransformGen` from config.
      Returns:
          list[TransformGen]
      """
      if is_train:
          min_size = cfg.INPUT.MIN_SIZE_TRAIN
          max_size = cfg.INPUT.MAX_SIZE_TRAIN
          sample_style = cfg.INPUT.MIN_SIZE_TRAIN_SAMPLING
      else:
          min_size = cfg.INPUT.MIN_SIZE_TEST
          max_size = cfg.INPUT.MAX_SIZE_TEST
          sample_style = "choice"
      if sample_style == "range":
          assert (
              len(min_size) == 2
          ), "more than 2 ({}) min_size(s) are provided for ranges".format(
              len(min_size)
          )
  
      logger = logging.getLogger(__name__)
      tfm_gens = []
      if is_train:
          tfm_gens.append(T.RandomFlip())
      tfm_gens.append(
          T.ResizeShortestEdge(min_size, max_size, sample_style)
      )
      if is_train:
          logger.info(
              "TransformGens used in training: " + str(tfm_gens)
          )
      return tfm_gens
  
file_path: detr/d2/detr/dataset_mapper.py
imports: import copy
  import logging
  import numpy
  import torch
  from detectron2.data import detection_utils
  from detectron2.data import transforms
  from detectron2.data.transforms import TransformGen
label_desc: Use image node_id 1 for calling a global function with example usage: build_transform_gen(cfg, is_train) and returns: tfm_gens