def input_to_template(input_example, label_list):
  """Convenience function to convert input into likely template."""
  if input_example.text_b is None:
    template = ("[CLS]<freq>1 <piece> <opt>%s</opt> <piece> "
                "[SEP]<freq>1 <piece> "
                "[PAD]<freq>*" % (input_example.text_a))
  else:
    template = ("[CLS]<freq>1 <piece> <opt>%s</opt> <piece> "
                "[SEP]<freq>1 <piece> <opt>%s</opt> <piece> "
                "[SEP]<freq>1 <piece> "
                "[PAD]<freq>*" % (input_example.text_a, input_example.text_b))

  if isinstance(input_example.label, list):
    # run_classifier_distillation's input file processor, vector labels
    prob_vector = np.array(input_example.label)
  else:
    # run_classifier's input file processor, string labels
    prob_vector = np.zeros(len(label_list))
    prob_vector[label_list.index(input_example.label)] = 1.0

  return template, prob_vector
Convenience function to convert input into likely template.
language/bert_extraction/steal_bert_classifier/embedding_perturbations/embedding_util.py