docstr: Test whether DDPPO can be built with both frameworks.
docstr_tok: ["Test","whether","DDPPO","can","be","built","with","both","frameworks","."]
code: def test_ddppo_compilation(self):
      """Test whether DDPPO can be built with both frameworks."""
      config = DDPPOConfig().resources(num_gpus_per_worker=0)
  
      num_iterations = 2
  
      for _ in framework_iterator(config, frameworks="torch"):
          algo = config.build(env="CartPole-v1")
          for i in range(num_iterations):
              results = algo.train()
              check_train_results(results)
              print(results)
              # Make sure, weights on all workers are the same.
              weights = algo.workers.foreach_worker(
                  lambda w: w.get_weights()
              )
              for w in weights[1:]:
                  check(w, weights[1])
  
          check_compute_single_action(algo)
          algo.stop()
  
file_path: ray/rllib_contrib/ddppo/tests/test_ddppo.py
imports: import unittest
  import pytest
  from rllib_ddppo.ddppo import DDPPOConfig
  import ray
  from ray.rllib.policy.sample_batch import DEFAULT_POLICY_ID
  from ray.rllib.utils.metrics.learner_info import LEARNER_INFO, LEARNER_STATS_KEY
  from ray.rllib.utils.test_utils import check, check_compute_single_action, check_train_results, framework_iterator
label_desc: Use image node_id 3 for calling the TestDDPPO obj's underlying member method code with example usage: obj.test_ddppo_compilation() without return types