code: def iterator_from_dataset(
      replay_buffer,
      num_steps=None,
      batch_size=None,
      single_deterministic_pass=None,
      session=None,
  ):
      ds = replay_buffer.as_dataset(
          num_steps=num_steps,
          sample_batch_size=batch_size,
          single_deterministic_pass=single_deterministic_pass,
      )
  
      if tf.executing_eagerly():
          for value in iter(ds):
              yield tf.nest.map_structure(lambda v: v.numpy(), value)
      else:
          itr = tf.compat.v1.data.make_initializable_iterator(ds)
          gn = itr.get_next()
          initialized = [False]
          while True:
              if not initialized[0]:
                  session.run(itr.initializer)
                  initialized[0] = True
              yield session.run(gn)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tf_agents import specs
  from tf_agents.replay_buffers import episodic_replay_buffer
  from tf_agents.utils import common
  from tf_agents.utils import test_utils
  from tensorflow.python.ops import list_ops
label_desc: Use image node_id 2 for calling a global function with example usage: iterator_from_dataset(replay_buffer, num_steps, batch_size, single_deterministic_pass, session) without return types