class_docstr: Base class for dataset tests.
docstr: Returns a callable that returns the next element of the dataset.
  
  Example use:
  ```python
  # In both graph and eager modes
  dataset = ...
  get_next = self.getNext(dataset)
  result = self.evaluate(get_next())
  ```
  
  Args:
    dataset: A dataset whose elements will be returned.
    requires_initialization: Indicates that when the test is executed in graph
      mode, it should use an initializable iterator to iterate through the
      dataset (e.g. when it contains stateful nodes). Defaults to False.
    shared_name: (Optional.) If non-empty, the returned iterator will be
      shared under the given name across multiple sessions that share the same
      devices (e.g. when using a remote server).
  Returns:
    A callable that returns the next element of `dataset`. Any `TensorArray`
    objects `dataset` outputs are stacked.
docstr_tok: ["Returns","a","callable","that","returns","the","next","element","of","the","dataset",".","Example","use",":","``","`","python","#","In","both","graph","and","eager","modes","dataset","=","...","get_next","=","self.getNext","(","dataset",")","result","=","self.evaluate","(","get_next","(",")",")","``","`","Args",":","dataset",":","A","dataset","whose","elements","will","be","returned",".","requires_initialization",":","Indicates","that","when","the","test","is","executed","in","graph","mode",",","it","should","use","an","initializable","iterator","to","iterate","through","the","dataset","(","e.g",".","when","it","contains","stateful","nodes",")",".","Defaults","to","False",".","shared_name",":","(","Optional",".",")","If","non-empty",",","the","returned","iterator","will","be","shared","under","the","given","name","across","multiple","sessions","that","share","the","same","devices","(","e.g",".","when","using","a","remote","server",")",".","Returns",":","A","callable","that","returns","the","next","element","of","`","dataset","`",".","Any","`","TensorArray","`","objects","`","dataset","`","outputs","are","stacked","."]
code: def getNext(
      self, dataset, requires_initialization=False, shared_name=None
  ):
      """Returns a callable that returns the next element of the dataset.
  
      Example use:
      ```python
      # In both graph and eager modes
      dataset = ...
      get_next = self.getNext(dataset)
      result = self.evaluate(get_next())
      ```
  
      Args:
        dataset: A dataset whose elements will be returned.
        requires_initialization: Indicates that when the test is executed in graph
          mode, it should use an initializable iterator to iterate through the
          dataset (e.g. when it contains stateful nodes). Defaults to False.
        shared_name: (Optional.) If non-empty, the returned iterator will be
          shared under the given name across multiple sessions that share the same
          devices (e.g. when using a remote server).
      Returns:
        A callable that returns the next element of `dataset`. Any `TensorArray`
        objects `dataset` outputs are stacked.
      """
  
      def ta_wrapper(gn):
          def _wrapper():
              r = gn()
              if isinstance(r, tensor_array_ops.TensorArray):
                  return r.stack()
              else:
                  return r
  
          return _wrapper
  
      # Create an anonymous iterator if we are in eager-mode or are graph inside
      # of a tf.function.
      if context.executing_eagerly() or ops.inside_function():
          iterator = iter(dataset)
          return ta_wrapper(
              iterator._next_internal
          )  # pylint: disable=protected-access
      else:
          if requires_initialization:
              iterator = dataset_ops.make_initializable_iterator(
                  dataset, shared_name
              )
              self.evaluate(iterator.initializer)
          else:
              iterator = dataset_ops.make_one_shot_iterator(dataset)
          get_next = iterator.get_next()
          return ta_wrapper(lambda: get_next)
  
imports: import os
  import random
  import re
  from tensorflow.python.data.experimental.ops import lookup_ops
  from tensorflow.python.data.experimental.ops import random_access
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.ops import test_mode
  from tensorflow.python.data.util import nest
  from tensorflow.python.data.util import structure
  from tensorflow.python.eager import context
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import config
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_dataset_ops
  from tensorflow.python.ops import gen_experimental_dataset_ops
  from tensorflow.python.ops import lookup_ops
  from tensorflow.python.ops import tensor_array_ops
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow.python.platform import test
label_desc: Use image node_id 4 for calling the DatasetTestBase obj's underlying member method code with example usage: obj.getNext(dataset, requires_initialization, shared_name) and returns: _wrapper, ta_wrapper, ta_wrapper, r, r