code: def get_default_tensorflow_config(tf_device="gpu", gpu_id=0):
      """Creates tensorflow config for graphs to run on CPU or GPU.
  
      Specifies whether to run graph on gpu or cpu and which GPU ID to use for multi
      GPU machines.
  
      Args:
        tf_device: 'cpu' or 'gpu'
        gpu_id: GPU ID to use if relevant
  
      Returns:
        Tensorflow config.
      """
  
      if tf_device == "cpu":
          os.environ[
              "CUDA_VISIBLE_DEVICES"
          ] = "-1"  # for training on cpu
          tf_config = tf.ConfigProto(
              log_device_placement=False, device_count={"GPU": 0}
          )
  
      else:
          os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
          os.environ["CUDA_VISIBLE_DEVICES"] = str(gpu_id)
  
          print("Selecting GPU ID={}".format(gpu_id))
  
          tf_config = tf.ConfigProto(log_device_placement=False)
          tf_config.gpu_options.allow_growth = True
  
      return tf_config
  
file_path: qlib/examples/benchmarks/TFT/libs/utils.py
imports: import os
  import pathlib
  import numpy
  import tensorflow
  from tensorflow.python.tools.inspect_checkpoint import print_tensors_in_checkpoint_file
label_desc: Use image node_id 6 for calling a global function with example usage: get_default_tensorflow_config(tf_device, gpu_id) and returns: tf_config