code: def compare(tfrecord_dir_a, tfrecord_dir_b, ignore_labels):
      max_label_size = 0 if ignore_labels else "full"
      print('Loading dataset "%s"' % tfrecord_dir_a)
      tflib.init_tf({"gpu_options.allow_growth": True})
      dset_a = dataset.TFRecordDataset(
          tfrecord_dir_a,
          max_label_size=max_label_size,
          repeat=False,
          shuffle_mb=0,
      )
      print('Loading dataset "%s"' % tfrecord_dir_b)
      dset_b = dataset.TFRecordDataset(
          tfrecord_dir_b,
          max_label_size=max_label_size,
          repeat=False,
          shuffle_mb=0,
      )
      tflib.init_uninitialized_vars()
  
      print("Comparing datasets")
      idx = 0
      identical_images = 0
      identical_labels = 0
      while True:
          if idx % 100 == 0:
              print("%d\r" % idx, end="", flush=True)
          try:
              images_a, labels_a = dset_a.get_minibatch_np(1)
          except tf.errors.OutOfRangeError:
              images_a, labels_a = None, None
          try:
              images_b, labels_b = dset_b.get_minibatch_np(1)
          except tf.errors.OutOfRangeError:
              images_b, labels_b = None, None
          if images_a is None or images_b is None:
              if images_a is not None or images_b is not None:
                  print("Datasets contain different number of images")
              break
          if images_a.shape == images_b.shape and np.all(
              images_a == images_b
          ):
              identical_images += 1
          else:
              print("Image %d is different" % idx)
          if labels_a.shape == labels_b.shape and np.all(
              labels_a == labels_b
          ):
              identical_labels += 1
          else:
              print("Label %d is different" % idx)
          idx += 1
      print("Identical images: %d / %d" % (identical_images, idx))
      if not ignore_labels:
          print("Identical labels: %d / %d" % (identical_labels, idx))
  
imports: import os
  import sys
  import glob
  import argparse
  import threading
  import six.moves.queue
  import traceback
  import numpy
  import tensorflow
  import PIL.Image
  import dnnlib.tflib
  from training import dataset
label_desc: Use image node_id 4 for calling a global function with example usage: compare(tfrecord_dir_a, tfrecord_dir_b, ignore_labels) without return types