class_docstr: KafkaStreamIODataset
docstr: Creates a `StreamIODataset` from kafka server with only a start offset.
  
  Args:
    topic: A `tf.string` tensor containing topic subscription.
    partition: A `tf.int64` tensor containing the partition.
    offset: A `tf.int64` tensor containing the start offset.
    servers: An optional list of bootstrap servers.
       For example: `localhost:9092`.
    configuration: An optional `tf.string` tensor containing
      configurations in [Key=Value] format.
      Global configuration: please refer to 'Global configuration properties'
        in librdkafka doc. Examples include
        ["enable.auto.commit=false", "heartbeat.interval.ms=2000"]
      Topic configuration: please refer to 'Topic configuration properties'
        in librdkafka doc. Note all topic configurations should be
        prefixed with `conf.topic.`. Examples include
        ["conf.topic.auto.offset.reset=earliest"]
      Reference: https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md
    internal: Whether the dataset is being created from within the named scope.
      Default: True
code: def __init__(
      self,
      topic,
      partition,
      offset,
      servers,
      configuration,
      internal=True,
  ):
      """Creates a `StreamIODataset` from kafka server with only a start offset.
  
      Args:
        topic: A `tf.string` tensor containing topic subscription.
        partition: A `tf.int64` tensor containing the partition.
        offset: A `tf.int64` tensor containing the start offset.
        servers: An optional list of bootstrap servers.
           For example: `localhost:9092`.
        configuration: An optional `tf.string` tensor containing
          configurations in [Key=Value] format.
          Global configuration: please refer to 'Global configuration properties'
            in librdkafka doc. Examples include
            ["enable.auto.commit=false", "heartbeat.interval.ms=2000"]
          Topic configuration: please refer to 'Topic configuration properties'
            in librdkafka doc. Note all topic configurations should be
            prefixed with `conf.topic.`. Examples include
            ["conf.topic.auto.offset.reset=earliest"]
          Reference: https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md
        internal: Whether the dataset is being created from within the named scope.
          Default: True
      """
      with tf.name_scope("KafkaStreamIODataset"):
          assert internal
  
          metadata = list(configuration or [])
          if servers is not None:
              metadata.append("bootstrap.servers=%s" % servers)
          resource = core_ops.io_kafka_readable_init(
              topic, partition, offset, metadata=metadata
          )
  
          self._resource = resource
  
          dataset = tf.data.experimental.Counter()
          dataset = dataset.map(
              lambda i: core_ops.io_kafka_readable_next(
                  self._resource, i
              )
          )
          dataset = dataset.apply(
              tf.data.experimental.take_while(
                  lambda v: tf.greater(tf.shape(v.message)[0], 0)
              )
          )
          dataset = dataset.unbatch()
  
          self._dataset = dataset
          super().__init__(self._dataset._variant_tensor)
  
file_path: io/tensorflow_io/python/ops/kafka_dataset_ops.py
imports: import tensorflow
  from tensorflow_io.python.ops import core_ops
label_desc: Use image node_id 1 to create a new KafkaStreamIODataset object from inherited base classes: tf.data with example: obj = KafkaStreamIODataset(topic, partition, offset, servers, configuration, internal)