def placeholders_from_spec(feature_spec):
  """Returns placeholders compatible with a given feature spec."""
  placeholders = {}
  for key, feature in feature_spec.items():
    placeholders[key] = tf.placeholder(dtype=feature.dtype,
                                       shape=[1] + feature.shape,
                                       name=key)
  return placeholders