code: def create_mnistrgb(
      tfrecord_dir, mnist_dir, num_images=1000000, random_seed=123
  ):
      print('Loading MNIST from "%s"' % mnist_dir)
      import gzip
  
      with gzip.open(
          os.path.join(mnist_dir, "train-images-idx3-ubyte.gz"), "rb"
      ) as file:
          images = np.frombuffer(file.read(), np.uint8, offset=16)
      images = images.reshape(-1, 28, 28)
      images = np.pad(
          images,
          [(0, 0), (2, 2), (2, 2)],
          "constant",
          constant_values=0,
      )
      assert (
          images.shape == (60000, 32, 32) and images.dtype == np.uint8
      )
      assert np.min(images) == 0 and np.max(images) == 255
  
      with TFRecordExporter(tfrecord_dir, num_images) as tfr:
          rnd = np.random.RandomState(random_seed)
          for _idx in range(num_images):
              tfr.add_image(
                  images[rnd.randint(images.shape[0], size=3)]
              )
  
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 6 for calling a global function with example usage: create_mnistrgb(tfrecord_dir, mnist_dir, num_images, random_seed) without return types