docstr: Test whether R2D2 can be built on all frameworks.
code: def test_r2d2_compilation(self):
      """Test whether R2D2 can be built on all frameworks."""
      config = (
          R2D2Config()
          .environment("CartPole-v1")
          .rollouts(num_rollout_workers=0)
          .training(
              model={
                  # Wrap with an LSTM and use a very simple base-model.
                  "use_lstm": True,
                  "max_seq_len": 20,
                  "fcnet_hiddens": [32],
                  "lstm_cell_size": 64,
              },
              dueling=False,
              lr=5e-4,
              zero_init_states=True,
              replay_buffer_config={"replay_burn_in": 20},
              num_steps_sampled_before_learning_starts=0,
          )
          .exploration(exploration_config={"epsilon_timesteps": 100000})
      )
  
      num_iterations = 1
  
      # Test building an R2D2 agent in all frameworks.
      for _ in framework_iterator(config, with_eager_tracing=True):
          algo = config.build()
          for i in range(num_iterations):
              results = algo.train()
              check_train_results(results)
              check_batch_sizes(results)
              print(results)
  
          check_compute_single_action(algo, include_state=True)
  
file_path: ray/rllib_contrib/r2d2/tests/test_r2d2.py
imports: import unittest
  from rllib_r2d2.r2d2.r2d2 import R2D2Config
  import ray
  from ray.rllib.utils.framework import try_import_tf, try_import_torch
  from ray.rllib.utils.metrics.learner_info import LEARNER_INFO
  from ray.rllib.utils.test_utils import check_compute_single_action, check_train_results, framework_iterator
label_desc: Use image node_id 3 for calling the TestR2D2 obj's underlying member method code with example usage: obj.test_r2d2_compilation() without return types