def placeholder_for_type(context,
                         type_spec,
                         name = None):
  """Produce a Tensorflow placeholder for this type_spec.

  Args:
    context: a NeuralQueryContext
    type_spec: a single type_spec (see tuple_dataset)
    name: a name to use for the placeholder

  Returns:
    a Tensorflow placeholder

    Raises:
      ValueError, if the type_spec is invalid
  """
  if type_spec == str:
    return tf.compat.v1.placeholder(tf.string, shape=[None], name=name)
  elif isinstance(type_spec, str) and context.is_type(type_spec):
    name = name or ('%s_ph' % type_spec)
    return context.placeholder(name, type_spec).tf
  else:
    raise ValueError('bad type spec %r' % type_spec)
Produce a Tensorflow placeholder for this type_spec.

  Args:
    context: a NeuralQueryContext
    type_spec: a single type_spec (see tuple_dataset)
    name: a name to use for the placeholder

  Returns:
    a Tensorflow placeholder

    Raises:
      ValueError, if the type_spec is invalid
  
language/nql/nql/dataset.py