def build_record_example(example, cand_size):
  """Create the bert inptus for this record."""
  CLS_ID = tf.constant([101], dtype=tf.int64)  # pylint: disable=invalid-name
  SEP_ID = tf.constant([102], dtype=tf.int64)  # pylint: disable=invalid-name

  context = example["context_input_ids"]
  # Gather the context removing zero padding at end of sentences.
  non_zeros = tf.where(tf.not_equal(context, tf.zeros_like(context)))
  context_gathered = tf.gather_nd(context, non_zeros)

  # create inputs
  bert_inputs = []
  input_masks = []
  segment_ids = []

  # make context
  ctx_segment_id = tf.concat([
      tf.zeros_like(CLS_ID, dtype=tf.int64),
      tf.zeros_like(context_gathered),
      tf.zeros_like(SEP_ID, dtype=tf.int64)
  ],
                             axis=0)
  ctx_segment_id = pad_and_cut(ctx_segment_id, FLAGS.max_seq_length)
  segment_ids.append(ctx_segment_id)

  new_ctx_input = tf.concat([CLS_ID, context_gathered, SEP_ID], axis=0)
  ctx_input_mask = tf.ones_like(new_ctx_input)
  ctx_input_mask = pad_and_cut(ctx_input_mask, FLAGS.max_seq_length)
  input_masks.append(ctx_input_mask)
  padded_new_ctx_input = pad_and_cut(new_ctx_input, FLAGS.max_seq_length)
  bert_inputs.append(padded_new_ctx_input)

  for i in range(cand_size):
    target_non_zero = tf.where(
        tf.not_equal(example["comp_input_ids" + str(i)],
                     tf.zeros_like(example["comp_input_ids" + str(i)])))
    targets_stripped = tf.gather_nd(example["comp_input_ids" + str(i)],
                                    target_non_zero)
    segment_id = tf.concat([
        tf.zeros_like(CLS_ID, dtype=tf.int64),
        tf.zeros_like(context_gathered),
        tf.zeros_like(SEP_ID, dtype=tf.int64),
        tf.ones_like(targets_stripped),
        tf.ones_like(SEP_ID, dtype=tf.int64)
    ],
                           axis=0)
    segment_id = pad_and_cut(segment_id, FLAGS.max_seq_length)
    segment_ids.append(segment_id)
    new_input = tf.concat(
        [CLS_ID, context_gathered, SEP_ID, targets_stripped, SEP_ID], axis=0)
    input_mask = tf.ones_like(new_input)
    input_mask = pad_and_cut(input_mask, FLAGS.max_seq_length)
    input_masks.append(input_mask)
    padded_new_input = pad_and_cut(new_input, FLAGS.max_seq_length)
    bert_inputs.append(padded_new_input)
  bert_inputs = tf.stack(bert_inputs, axis=0)
  input_masks = tf.stack(input_masks, axis=0)
  segment_ids = tf.stack(segment_ids, axis=0)

  label = tf.constant([0], dtype=tf.int64)

  out = Outputs_And_Context(bert_inputs, input_masks, segment_ids, label)
  return out
Create the bert inptus for this record.
language/conpono/evals/run_record.py