class_docstr: This class manages the *InputMode.SPARK* data feeding process from the perspective of the TensorFlow application.
  
  Args:
    :mgr: TFManager instance associated with this Python worker process.
    :train_mode: boolean indicating if the data feed is expecting an output response (e.g. inferencing).
    :qname_in: *INTERNAL_USE*
    :qname_out: *INTERNAL_USE*
    :input_mapping: *For Spark ML Pipelines only*.  Dictionary of input DataFrame columns to input TensorFlow tensors.
class_docstr_tok: ["This","class","manages","the","*","InputMode.SPARK","*","data","feeding","process","from","the","perspective","of","the","TensorFlow","application",".","Args",":",":","mgr",":","TFManager","instance","associated","with","this","Python","worker","process",".",":","train_mode",":","boolean","indicating","if","the","data","feed","is","expecting","an","output","response","(","e.g",".","inferencing",")",".",":","qname_in",":","*","INTERNAL_USE","*",":","qname_out",":","*","INTERNAL_USE","*",":","input_mapping",":","*","For","Spark","ML","Pipelines","only","*",".","Dictionary","of","input","DataFrame","columns","to","input","TensorFlow","tensors","."]
docstr: Gets a batch of items from the input RDD.
  
  If multiple tensors are provided per row in the input RDD, e.g. tuple of (tensor1, tensor2, ..., tensorN) and:
  
  * no ``input_mapping`` was provided to the DataFeed constructor, this will return an array of ``batch_size`` tuples,
    and the caller is responsible for separating the tensors.
  * an ``input_mapping`` was provided to the DataFeed constructor, this will return a dictionary of N tensors,
    with tensor names as keys and arrays of length ``batch_size`` as values.
  
  Note: if the end of the data is reached, this may return with fewer than ``batch_size`` items.
  
  Args:
    :batch_size: number of items to retrieve.
  
  Returns:
    A batch of items or a dictionary of tensors.
docstr_tok: ["Gets","a","batch","of","items","from","the","input","RDD",".","If","multiple","tensors","are","provided","per","row","in","the","input","RDD",",","e.g",".","tuple","of","(","tensor1",",","tensor2",",","...",",","tensorN",")","and",":","*","no","``","input_mapping","``","was","provided","to","the","DataFeed","constructor",",","this","will","return","an","array","of","``","batch_size","``","tuples",",","and","the","caller","is","responsible","for","separating","the","tensors",".","*","an","``","input_mapping","``","was","provided","to","the","DataFeed","constructor",",","this","will","return","a","dictionary","of","N","tensors",",","with","tensor","names","as","keys","and","arrays","of","length","``","batch_size","``","as","values",".","Note",":","if","the","end","of","the","data","is","reached",",","this","may","return","with","fewer","than","``","batch_size","``","items",".","Args",":",":","batch_size",":","number","of","items","to","retrieve",".","Returns",":","A","batch","of","items","or","a","dictionary","of","tensors","."]
code: def next_batch(self, batch_size):
      """Gets a batch of items from the input RDD.
  
      If multiple tensors are provided per row in the input RDD, e.g. tuple of (tensor1, tensor2, ..., tensorN) and:
  
      * no ``input_mapping`` was provided to the DataFeed constructor, this will return an array of ``batch_size`` tuples,
        and the caller is responsible for separating the tensors.
      * an ``input_mapping`` was provided to the DataFeed constructor, this will return a dictionary of N tensors,
        with tensor names as keys and arrays of length ``batch_size`` as values.
  
      Note: if the end of the data is reached, this may return with fewer than ``batch_size`` items.
  
      Args:
        :batch_size: number of items to retrieve.
  
      Returns:
        A batch of items or a dictionary of tensors.
      """
      tensors = (
          []
          if self.input_tensors is None
          else {tensor: [] for tensor in self.input_tensors}
      )
      count = 0
      queue_in = self.queue_in
      no_input_tensors = self.input_tensors is None
      while count < batch_size:
          item = queue_in.get(block=True)
          if item is None:
              # End of Feed
              logger.info("next_batch() got None")
              queue_in.task_done()
              self.done_feeding = True
              break
          elif type(item) is marker.EndPartition:
              # End of Partition
              logger.info("next_batch() got EndPartition")
              queue_in.task_done()
              if not self.train_mode and count > 0:
                  break
          else:
              # Normal item
              if no_input_tensors:
                  tensors.append(item)
              else:
                  for i in range(len(self.input_tensors)):
                      tensors[self.input_tensors[i]].append(item[i])
              count += 1
              queue_in.task_done()
      return tensors
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import nested_scopes
  from __future__ import print_function
  import getpass
  import logging
  import pkg_resources
  from packaging import version
  from six.moves.queue import Empty
  from .None import compat, marker
label_desc: Use image node_id 2 for calling the DataFeed obj's underlying member method code with example usage: obj.next_batch(batch_size) and returns: tensors