code: def testMaybeEndEpisode(self):
      spec = [
          specs.TensorSpec([3], tf.float32, "action"),
          [
              specs.TensorSpec([5], tf.float32, "lidar"),
              specs.TensorSpec([3, 2], tf.float32, "camera"),
          ],
      ]
      replay_buffer = episodic_replay_buffer.EpisodicReplayBuffer(
          spec, capacity=2
      )
      episode_id = replay_buffer.create_episode_ids()
      self.evaluate(tf.compat.v1.global_variables_initializer())
      self.evaluate(tf.compat.v1.local_variables_initializer())
  
      episode_id = replay_buffer._get_episode_id(episode_id)
      completed = replay_buffer._maybe_end_episode(episode_id)
      with tf.control_dependencies([completed]):
          completed_episodes = replay_buffer._completed_episodes()
  
      (
          episode_id_value,
          completed_value,
          completed_episodes_value,
      ) = self.evaluate((episode_id, completed, completed_episodes))
      self.assertEqual(0, episode_id_value)
      self.assertEqual(False, completed_value)
      self.assertEmpty(completed_episodes_value)
  
      # Mark episode as completed.
      completed = replay_buffer._maybe_end_episode(0, end_episode=True)
      with tf.control_dependencies([completed]):
          completed_episodes = replay_buffer._completed_episodes()
      completed_value, completed_episodes_value = self.evaluate(
          (completed, completed_episodes)
      )
      self.assertEqual(True, completed_value)
      self.assertEqual([0], completed_episodes_value)
  
      # Invalid episode cannot be completed.
      completed = replay_buffer._maybe_end_episode(1, end_episode=True)
      with tf.control_dependencies([completed]):
          completed_episodes = replay_buffer._completed_episodes()
      completed_value, completed_episodes_value = self.evaluate(
          (completed, completed_episodes)
      )
      self.assertEqual(False, completed_value)
      self.assertEqual([0], completed_episodes_value)
  
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 10 for calling the EpisodicReplayBufferTest obj's underlying member method code with example usage: obj.testMaybeEndEpisode() without return types