code: def make_ddpg_models(policy: Policy) -> ModelV2:
      if policy.config["use_state_preprocessor"]:
          default_model = None  # catalog decides
          num_outputs = 256  # arbitrary
          policy.config["model"]["no_final_linear"] = True
      else:
          default_model = (
              TorchNoopModel
              if policy.config["framework"] == "torch"
              else NoopModel
          )
          num_outputs = int(np.product(policy.observation_space.shape))
  
      model = ModelCatalog.get_model_v2(
          obs_space=policy.observation_space,
          action_space=policy.action_space,
          num_outputs=num_outputs,
          model_config=policy.config["model"],
          framework=policy.config["framework"],
          model_interface=(
              DDPGTorchModel
              if policy.config["framework"] == "torch"
              else DDPGTFModel
          ),
          default_model=default_model,
          name="ddpg_model",
          actor_hidden_activation=policy.config[
              "actor_hidden_activation"
          ],
          actor_hiddens=policy.config["actor_hiddens"],
          critic_hidden_activation=policy.config[
              "critic_hidden_activation"
          ],
          critic_hiddens=policy.config["critic_hiddens"],
          twin_q=policy.config["twin_q"],
          add_layer_norm=(
              policy.config["exploration_config"].get("type")
              == "ParameterNoise"
          ),
      )
  
      policy.target_model = ModelCatalog.get_model_v2(
          obs_space=policy.observation_space,
          action_space=policy.action_space,
          num_outputs=num_outputs,
          model_config=policy.config["model"],
          framework=policy.config["framework"],
          model_interface=(
              DDPGTorchModel
              if policy.config["framework"] == "torch"
              else DDPGTFModel
          ),
          default_model=default_model,
          name="target_ddpg_model",
          actor_hidden_activation=policy.config[
              "actor_hidden_activation"
          ],
          actor_hiddens=policy.config["actor_hiddens"],
          critic_hidden_activation=policy.config[
              "critic_hidden_activation"
          ],
          critic_hiddens=policy.config["critic_hiddens"],
          twin_q=policy.config["twin_q"],
          add_layer_norm=(
              policy.config["exploration_config"].get("type")
              == "ParameterNoise"
          ),
      )
  
      return model
  
file_path: ray/rllib_contrib/ddpg/src/rllib_ddpg/ddpg/utils.py
imports: import gymnasium
  import numpy
  from rllib_ddpg.ddpg.ddpg_tf_model import DDPGTFModel
  from rllib_ddpg.ddpg.ddpg_torch_model import DDPGTorchModel
  from rllib_ddpg.ddpg.noop_model import NoopModel, TorchNoopModel
  from ray.rllib import Policy
  from ray.rllib.models import ModelV2
  from ray.rllib.models.catalog import ModelCatalog
  from ray.rllib.utils.error import UnsupportedSpaceException
label_desc: Use image node_id 1 for calling a global function with example usage: make_ddpg_models(policy) and returns: model