def spec_as_tf_type(spec):
  """Convert a type_spec to a tf type.

  Args:
    spec: a single specification for tuple_generator_builder

  Returns:
    type specification required by tf.data.Dataset.from_generator
  """
  if spec == str:
    return tf.string
  elif isinstance(spec, int):
    return tf.int32
  else:
    return tf.float32
Convert a type_spec to a tf type.

  Args:
    spec: a single specification for tuple_generator_builder

  Returns:
    type specification required by tf.data.Dataset.from_generator
  
language/nql/nql/dataset.py