Trim and pad first dimension of all features to size length.

def trim_and_pad_all_features(features, length):
  """Trim and pad first dimension of all features to size length."""
  return {k: _trim_and_pad(v, length) for k, v in features.items()}