class_docstr: Sanity tests for A2C exec impl.
class_docstr_tok: ["Sanity","tests","for","A2C","exec","impl","."]
docstr: Test whether an A2C can be built with both frameworks.
docstr_tok: ["Test","whether","an","A2C","can","be","built","with","both","frameworks","."]
code: def test_a2c_compilation(self):
      """Test whether an A2C can be built with both frameworks."""
      config = A2CConfig().rollouts(
          num_rollout_workers=2, num_envs_per_worker=2
      )
  
      num_iterations = 1
  
      # Test against all frameworks.
      for _ in framework_iterator(config, with_eager_tracing=True):
          for env in ["ALE/Pong-v5", "CartPole-v1", "Pendulum-v1"]:
              config.environment(env)
              algo = config.build()
              for i in range(num_iterations):
                  results = algo.train()
                  check_train_results(results)
                  print(results)
              check_compute_single_action(algo)
              algo.stop()
  
file_path: ray/rllib_contrib/a2c/tests/test_a2c.py
imports: import unittest
  from rllib_a2c.a2c import A2CConfig
  import ray
  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 TestA2C obj's underlying member method code with example usage: obj.test_a2c_compilation() without return types