class_docstr: A class representing a training dataset for KB.
  Dataset.dataset is a tf.data.Dataset object and Dataset.iterator is an
  iterator over the dataset.
  Dataset.input_tensors are the input tensors used in downstream model, it
  can be returned by Dataset.get_input_tensors()
  Dataset iteration parameters are:
  batchsize: size of each mini-batch
  num_epochs: number of epochs to iterate over the dataset
  
  Each tuple is processed to include the neighborhoods of the entities using
  the following parameters:
  max_neighbors: maximum number of entities in the neighborhood, if None this
  is specified from train_graph
  max_negatives: maximum  number of negative entities samples for each example
class_docstr_tok: ["A","class","representing","a","training","dataset","for","KB",".","Dataset.dataset","is","a","tf.data.Dataset","object","and","Dataset.iterator","is","an","iterator","over","the","dataset",".","Dataset.input_tensors","are","the","input","tensors","used","in","downstream","model",",","it","can","be","returned","by","Dataset.get_input_tensors","(",")","Dataset","iteration","parameters","are",":","batchsize",":","size","of","each","mini-batch","num_epochs",":","number","of","epochs","to","iterate","over","the","dataset","Each","tuple","is","processed","to","include","the","neighborhoods","of","the","entities","using","the","following","parameters",":","max_neighbors",":","maximum","number","of","entities","in","the","neighborhood",",","if","None","this","is","specified","from","train_graph","max_negatives",":","maximum","number","of","negative","entities","samples","for","each","example"]
docstr: Create a tf.data.Dataset input pipeline and a dataset iterator.
docstr_tok: ["Create","a","tf.data.Dataset","input","pipeline","and","a","dataset","iterator","."]
code: def create_dataset_iterator(
      self, num_parallel=64, prefetch=5, shuffle_buffer=-1
  ):
      """Create a tf.data.Dataset input pipeline and a dataset iterator."""
      # dataset = tf.data.Dataset.from_generator(
      #     self._tuple_iterator,
      #     (tf.int64, tf.int64, tf.int64),
      #     (tf.TensorShape([]), tf.TensorShape([]), tf.TensorShape([]))
      #     # (tf.int64, tf.int64, tf.int64, tf.int64, tf.int64, tf.int64),
      #     # (tf.TensorShape([]), tf.TensorShape([self.max_neighbors]),
      #     #  tf.TensorShape([1]), tf.TensorShape([self.max_negatives + 1])
      #     #  tf.TensorShape([self.max_negatives + 1, self.max_neighbors]),
      #     #  tf.TensorShape([self.max_negatives + 1]))
      # )
      # if device == "worker":
      #   data_device = tf.device("/job:worker")
      # else:
      #   data_device = tf.device("/cpu:0")
      # with data_device:
      dataset = tf.data.Dataset.from_generator(
          self._tuple_iterator, tf.int64, tf.TensorShape([4])
      )
      if self.mode == "train":
          if shuffle_buffer == -1:
              shuffle_buffer = self.train_graph.tuple_store.shape[0]
          dataset = dataset.shuffle(shuffle_buffer)
      # pylint: disable=g-long-lambda
      output_dtypes = [
          tf.int64,
          tf.int64,
          tf.int64,
          tf.int64,
          tf.int64,
          tf.int64,
      ]
      if isinstance(self.train_graph, clueweb_text_graph.CWTextGraph):
          output_dtypes.append(tf.int64)
          output_dtypes.append(tf.float32)
      elif self.max_text_len:
          output_dtypes.append(tf.int64)
      dataset = dataset.map(
          lambda example_tuple: tf.py_func(
              self.featurize_each_example,
              [example_tuple],
              output_dtypes,
          ),
          num_parallel_calls=num_parallel,
      )
      dataset = dataset.repeat(self.num_epochs)
      dataset = dataset.batch(self.batchsize)
      dataset = dataset.prefetch(prefetch)
      self.dataset = dataset
      _ = self.get_output_shapes()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import clueweb_text_graph
  import numpy
  import tensorflow
label_desc: Use image node_id 4 for calling the Dataset obj's underlying member method code with example usage: obj.create_dataset_iterator(num_parallel, prefetch, shuffle_buffer) without return types