code: def convert_to_tfrecord(input_files, output_file):
      """Converts a file to TFRecords."""
      print("Generating %s" % output_file)
      with tf.python_io.TFRecordWriter(output_file) as record_writer:
          for input_file in input_files:
              data_dict = read_pickle_from_file(input_file)
              data = data_dict["data"]
              labels = data_dict["labels"]
              num_entries_in_batch = len(labels)
              for i in range(num_entries_in_batch):
                  example = tf.train.Example(
                      features=tf.train.Features(
                          feature={
                              "image": _bytes_feature(
                                  data[i].tobytes()
                              ),
                              "label": _int64_feature(labels[i]),
                          }
                      )
                  )
                  record_writer.write(example.SerializeToString())
  
file_path: dragonfly/examples/nas/cg/cifar/generate_cifar10_tfrecords.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import argparse
  import cPickle
  import os
  import tarfile
  from six.moves import xrange
  import tensorflow
label_desc: Use image node_id 6 for calling a global function with example usage: convert_to_tfrecord(input_files, output_file) without return types