def _call_model(model, graph_piece, *, logging_name):
  """Returns results of model, after checking the unchanged set of features."""
  actual_features = set(graph_piece.features.keys())
  expected_features = set(model.input.features.keys())
  if expected_features != actual_features:
    raise ValueError(
        f"The feature set of {logging_name} has changed since this layer "
        f"was built. Expected {sorted(expected_features)}, "
        f"got {sorted(actual_features)}.")

  return model(graph_piece)