def get_features_and_labels(data_sources,
                            batch_size,
                            model_config,
                            use_tpu=False,
                            shuffle=False,
                            num_epochs=None,
                            scope='input_fn'):
  """Get dict of features and labels."""
  feature_keys_to_remove = STRING_FEATURE_KEYS if use_tpu else []
  feature_keys = _remove_keys(FEATURE_KEYS, feature_keys_to_remove)

  if model_config.model_parameters.use_segment_ids:
    feature_keys.append(constants.SEGMENT_ID_KEY)
  if model_config.model_parameters.use_foreign_key_features:
    feature_keys.append(constants.FOREIGN_KEY_KEY)
  if model_config.model_parameters.use_alignment_features:
    feature_keys.append(constants.ALIGNED_KEY)

  static_padded_shapes = None
  if use_tpu:
    static_padded_shapes = _get_static_padded_shapes(model_config)

  sequence_decoder = _get_sequence_decoder(
      use_segment_ids=model_config.model_parameters.use_segment_ids,
      use_foreign_key_features=model_config.model_parameters
      .use_foreign_key_features,
      string_alignment_features=model_config.model_parameters
      .use_alignment_features)

  return input_utils.decode_features_and_labels(
      sequence_decoder,
      feature_keys,
      LABEL_KEYS,
      data_sources,
      batch_size,
      static_padded_shapes,
      drop_remainder=use_tpu,
      shuffle=shuffle,
      num_epochs=num_epochs,
      scope=scope)
Get dict of features and labels.
language/xsp/model/input_pipeline.py