def _flatten_value_and_weights_to_list_of_tuples(
    batch_values: Tuple[np.ndarray, ...]) -> Iterable[Any]:
  """Converts a batch of vocabulary and weights to a list of KV tuples."""
  batch_value, weights = batch_values

  # TODO(b/36603294): Perhaps obviate the tolist(). It is currently used so
  # that we go to native Python types for more efficient followup
  # processing.
  batch_value = batch_value.tolist()
  weights = weights.tolist()
  return zip(batch_value, weights)
Converts a batch of vocabulary and weights to a list of KV tuples.
tensorflow_transform/beam/analyzer_impls.py