code: def run_graph_single_device(device="cpu", device_id=0):
      with tf.device("/{0}:{1}".format(device, device_id)):
          daliset = get_dataset(device, device_id)
  
          iterator = tf_v1.data.make_initializable_iterator(daliset)
          images, labels = iterator.get_next()
  
          # images = tf_v1.reshape(images, [BATCH_SIZE, IMAGE_SIZE*IMAGE_SIZE])
          labels = tf_v1.reshape(
              tf_v1.one_hot(labels, NUM_CLASSES),
              [BATCH_SIZE, NUM_CLASSES],
          )
  
          logits_train = graph_model(
              images, reuse=False, is_training=True
          )
          logits_test = graph_model(
              images, reuse=True, is_training=False
          )
  
          loss_op = tf_v1.reduce_mean(
              tf_v1.nn.softmax_cross_entropy_with_logits(
                  logits=logits_train, labels=labels
              )
          )
          train_step = tf_v1.train.AdamOptimizer().minimize(loss_op)
  
          correct_pred = tf_v1.equal(
              tf_v1.argmax(logits_test, 1), tf_v1.argmax(labels, 1)
          )
          accuracy = tf_v1.reduce_mean(
              tf_v1.cast(correct_pred, tf_v1.float32)
          )
  
      train_graph([iterator.initializer], train_step, accuracy)
  
imports: import nvidia.dali.plugin.tf
  import os
  from nvidia.dali.pipeline import Pipeline
  import nvidia.dali.fn
  import nvidia.dali.types
  from test_utils_tensorflow import num_available_gpus
  from shutil import rmtree
  import tensorflow
  import tensorflow.compat.v1
label_desc: Use image node_id 8 for calling a global function with example usage: run_graph_single_device(device, device_id) without return types