code: def get_digits_by_label(images, labels):
      data_dict = []
      for clazz in range(0, 10):
          clazz_filter = np.where(labels == clazz)
          data_dict.append(
              list(images[clazz_filter].reshape((-1, 28, 28)))
          )
      return data_dict
  
file_path: tensorpack/examples/SimilarityLearning/embedding_data.py
imports: import numpy
  from tensorpack.dataflow import BatchData, dataset
label_desc: Use image node_id 2 for calling a global function with example usage: get_digits_by_label(images, labels) and returns: data_dict