def get_dense_is_inside_for_sparse_spans(sparse_start_positions: tf.Tensor,
                                         sparse_end_positions: tf.Tensor,
                                         seq_length: int) -> tf.Tensor:
  """Dense mask whether position is inside span given sparse starts / ends."""
  dense_start_positions = sparse_to_dense_1d(sparse_start_positions, seq_length)
  dense_end_positions = sparse_to_dense_1d(sparse_end_positions, seq_length)
  return get_dense_is_inside_for_dense_spans(dense_start_positions,
                                             dense_end_positions)
Dense mask whether position is inside span given sparse starts / ends.
language/mentionmemory/utils/mention_preprocess_utils.py