code: def testMultipleAddBatch(self):
      spec = specs.TensorSpec([3], tf.int32, "lidar")
      replay_buffer = episodic_replay_buffer.EpisodicReplayBuffer(
          spec,
          capacity=3,
          begin_episode_fn=lambda _: False,
          end_episode_fn=lambda _: False,
      )
  
      values = np.ones(spec.shape.as_list(), dtype=np.int32)
      values = np.stack([values, 10 * values, 100 * values])
      episode_ids = replay_buffer.create_episode_ids(num_episodes=3)
      # In this case all episodes are valid, so it will add all the values.
      # Add 1 to ep0, 10 to ep1, 100 to ep2
      new_episode_ids = replay_buffer.add_batch(values, episode_ids)
      # In this case the second episode will be invalid because we're starting
      # two new episodes with a capacity of 3, so ep1 with location 1 is
      # now going to be replaced by ep4 (in location 1).  As a result we won't
      # add its values.
      #
      # Add 1 to ep3 (was ep0), ., 100 to ep4 (was ep1).
      replay_buffer._begin_episode_fn = lambda _: [True, False, True]
      new_episode_ids_2 = replay_buffer.add_batch(
          values, new_episode_ids
      )
      # In this case all episodes are valid, so it will add all the values.
      # Add 1 to ep3, 10 to ep5 (was ep2), 100 to ep4.
      replay_buffer._begin_episode_fn = lambda _: [False, True, False]
      new_episode_ids_3 = replay_buffer.add_batch(
          values, new_episode_ids_2
      )
  
      # End result: ep3 with [1, 1], ep4 with [100, 100], ep5 with [10].
      items = [replay_buffer._get_episode(i) for i in [3, 4, 5]]
  
      self.evaluate(tf.compat.v1.global_variables_initializer())
      self.evaluate(tf.compat.v1.local_variables_initializer())
      self.assertAllEqual(
          ([0, 1, 2], [3, 1, 4], [3, 5, 4]),
          self.evaluate(
              (new_episode_ids, new_episode_ids_2, new_episode_ids_3)
          ),
      )
      self.assertEqual(
          5, self.evaluate(replay_buffer._get_last_episode_id())
      )
      items_ = self.evaluate(items)
      self.assertAllEqual(items_[0], [values[0], values[0]])
      self.assertAllEqual(items_[1], [values[2], values[2]])
      self.assertAllEqual(items_[2], [values[1]])
  
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 21 for calling the EpisodicReplayBufferTest obj's underlying member method code with example usage: obj.testMultipleAddBatch() without return types