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: Iterate over training tuples.
docstr_tok: ["Iterate","over","training","tuples","."]
code: def _tuple_iterator(self):
      """Iterate over training tuples."""
      if self.mode == "train":
          np.random.shuffle(self.data_graph.tuple_store)
      for example in self.data_graph.tuple_store:
          s, r, t = example
          yield s, r, t, False
          # if self.train_graph.add_inverse_edge:
          #   inv_r = self.train_graph.get_inverse_relation_from_id(r)
          #   yield t, inv_r, s, False
          if self.model_type not in [
              "source_rel_attention",
              "source_path_attention",
          ]:
              yield s, r, t, True
  
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 2 for calling the Dataset obj's underlying member method code with example usage: obj._tuple_iterator() without return types