def _nli_line_to_tensors(tf_line, tokenizer):
  """Map a tensor line from a NLI file to tensor dictionary."""
  def _tensorize(line):
    example = json.loads(line)
    label = NLI_LABEL_MAP.get(example["gold_label"], -1)
    return (tokenizer.tokenize(example["sentence1"]),
            tokenizer.tokenize(example["sentence2"]), example["pairID"],
            np.int32(label))

  tf_sentence1, tf_sentence2, tf_id, tf_label = (
      tensor_utils.shaped_py_func(
          func=_tensorize,
          inputs=[tf_line],
          types=[tf.string, tf.string, tf.string, tf.int32],
          shapes=[[None], [None], [], []],
          stateful=False))
  return {
      "premise": tf_sentence1,
      "hypothesis": tf_sentence2,
      "id": tf_id,
      "label": tf_label
  }
Map a tensor line from a NLI file to tensor dictionary.
language/boolq/run_recurrent_model_boolq.py