docstr: Test whether DDPG can be built with both frameworks.
docstr_tok: ["Test","whether","DDPG","can","be","built","with","both","frameworks","."]
code: def test_ddpg_compilation(self):
      """Test whether DDPG can be built with both frameworks."""
      config = (
          DDPGConfig()
          .training(num_steps_sampled_before_learning_starts=0)
          .rollouts(num_rollout_workers=0, num_envs_per_worker=2)
          .exploration(exploration_config={"random_timesteps": 100})
      )
  
      num_iterations = 1
  
      # Test against all frameworks.
      for _ in framework_iterator(config, with_eager_tracing=True):
          algo = config.build(env="Pendulum-v1")
          for i in range(num_iterations):
              results = algo.train()
              check_train_results(results)
              print(results)
          check_compute_single_action(algo)
          # Ensure apply_gradient_fn is being called and updating global_step
          pol = algo.get_policy()
          if config.framework_str == "tf":
              a = pol.get_session().run(pol.global_step)
          else:
              a = pol.global_step
          check(convert_to_numpy(a), 500)
          algo.stop()
  
imports: import copy
  import re
  import unittest
  import gymnasium
  import numpy
  from gymnasium.spaces import Box
  from rllib_ddpg.ddpg import DDPGConfig
  import ray
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.utils.framework import try_import_tf, try_import_torch
  from ray.rllib.utils.numpy import convert_to_numpy, fc, huber_loss, l2_loss, relu, sigmoid
  from ray.rllib.utils.replay_buffers.utils import patch_buffer_with_fake_sampling_method
  from ray.rllib.utils.spaces.simplex import Simplex
  from ray.rllib.utils.test_utils import check, check_compute_single_action, check_train_results, framework_iterator
  from ray.rllib.utils.torch_utils import convert_to_torch_tensor
label_desc: Use image node_id 3 for calling the TestDDPG obj's underlying member method code with example usage: obj.test_ddpg_compilation() without return types