code: def prepare_TFRecord_data(
      data_dir, max_seq_length, encoder, output_dir
  ):
      """
      Args:
          data_dir: The input data directory.
          max_seq_length: Max sequence length.
          output_dir: The directory to save the TFRecord files in.
      """
      train_fn = os.path.join(data_dir, "train.txt")
      if os.path.isfile(train_fn):
          tf.logging.info("Processing %s" % train_fn)
          train_examples = read_raw_data(train_fn)
          train_file = os.path.join(output_dir, "train.tf_record")
          file_based_convert_examples_to_features(
              train_examples, max_seq_length, encoder, train_file
          )
  
      dev_fn = os.path.join(data_dir, "dev.txt")
      if os.path.isfile(dev_fn):
          tf.logging.info("Processing %s" % dev_fn)
          eval_examples = read_raw_data(dev_fn)
          eval_file = os.path.join(output_dir, "dev.tf_record")
          file_based_convert_examples_to_features(
              eval_examples, max_seq_length, encoder, eval_file
          )
  
      test_fn = os.path.join(data_dir, "test.txt")
      if os.path.isfile(test_fn):
          tf.logging.info("Processing %s" % test_fn)
          test_examples = read_raw_data(test_fn)
          test_file = os.path.join(output_dir, "test.tf_record")
          file_based_convert_examples_to_features(
              test_examples,
              max_seq_length,
              encoder,
              test_file,
              EOS_token=None,
          )
  
imports: import os
  import collections
  import tensorflow
label_desc: Use image node_id 4 for calling a global function with example usage: prepare_TFRecord_data(data_dir, max_seq_length, encoder, output_dir) without return types