code: def testExtend(self, stateless):
      spec = specs.TensorSpec([], tf.int32, "action")
      replay_buffer = episodic_replay_buffer.EpisodicReplayBuffer(
          spec,
          capacity=3,
          begin_episode_fn=lambda _: False,
          end_episode_fn=lambda _: False,
      )
  
      if stateless:
          extend_ids = replay_buffer.create_episode_ids(3)
          stateful_replay_buffer = None
      else:
          stateful_replay_buffer = (
              episodic_replay_buffer.StatefulEpisodicReplayBuffer(
                  replay_buffer, num_episodes=3
              )
          )
          extend_ids = stateful_replay_buffer.episode_ids
  
      episodes1 = episodic_replay_buffer.Episodes(
          length=tf.constant([2, 1, 3], dtype=tf.int64),
          completed=tf.constant([0, 0, 1], dtype=tf.uint8),
          tensor_lists=tf.stack(
              [
                  list_ops.tensor_list_from_tensor(
                      tf.constant([100, 200], dtype=spec.dtype),
                      element_shape=spec.shape,
                  ),
                  list_ops.tensor_list_from_tensor(
                      tf.constant([999], dtype=spec.dtype),
                      element_shape=spec.shape,
                  ),
                  list_ops.tensor_list_from_tensor(
                      tf.constant([1, 2, 3], dtype=spec.dtype),
                      element_shape=spec.shape,
                  ),
              ]
          ),
      )
  
      episodes2 = episodic_replay_buffer.Episodes(
          length=tf.constant([1, 3], dtype=tf.int64),
          completed=tf.constant([0, 1], dtype=tf.uint8),
          tensor_lists=tf.stack(
              [
                  list_ops.tensor_list_from_tensor(
                      tf.constant([888], dtype=spec.dtype),
                      element_shape=spec.shape,
                  ),
                  list_ops.tensor_list_from_tensor(
                      tf.constant([4, 5, 6], dtype=spec.dtype),
                      element_shape=spec.shape,
                  ),
              ]
          ),
      )
  
      self.evaluate(tf.compat.v1.global_variables_initializer())
      self.evaluate(tf.compat.v1.local_variables_initializer())
      if stateless:
          extended_ids_1 = replay_buffer.extend_episodes(
              extend_ids, [0, 1, 2], episodes1
          )
          extend_ids = extended_ids_1
          replay_buffer._begin_episode_fn = lambda _: [False, True]
          extended_ids_2 = replay_buffer.extend_episodes(
              extend_ids, [1, 2], episodes2
          )
      else:
          replay_buffer._begin_episode_fn = lambda _: False
          extended_ids_1 = stateful_replay_buffer.extend_episodes(
              [0, 1, 2], episodes1
          )
          replay_buffer._begin_episode_fn = lambda _: [False, True]
          extended_ids_2 = stateful_replay_buffer.extend_episodes(
              [1, 2], episodes2
          )
  
      if stateless:
          extended_ids_1_value, extended_ids_2_value = self.evaluate(
              (extended_ids_1, extended_ids_2)
          )
      else:
          extended_ids_1_value = self.evaluate(extended_ids_1)
          extended_ids_2_value = self.evaluate(extended_ids_2)
  
      self.assertAllEqual(extended_ids_1_value, [0, 1, 2])
      self.assertAllEqual(extended_ids_2_value, [0, 1, 3])
  
      if not stateless:
          self.assertAllEqual(self.evaluate(extend_ids), [0, 1, 3])
  
      self.assertAllEqual(
          self.evaluate(replay_buffer._get_episode(1)), [999, 888]
      )
      self.assertAllEqual(
          self.evaluate(replay_buffer._get_episode(2)), [1, 2, 3]
      )
      self.assertAllEqual(
          self.evaluate(replay_buffer._get_episode(3)), [4, 5, 6]
      )
  
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 28 for calling the EpisodicReplayBufferTest obj's underlying member method code with example usage: obj.testExtend(stateless) without return types