code: def test_loss(self):
      config = (
          ppo.PPOConfig()
          .experimental(_enable_new_api_stack=True)
          .environment("CartPole-v1")
          .rollouts(
              num_rollout_workers=0,
          )
          .training(
              gamma=0.99,
              model=dict(
                  fcnet_hiddens=[10, 10],
                  fcnet_activation="linear",
                  vf_share_layers=False,
              ),
          )
      )
  
      for fw in framework_iterator(config, ("tf2", "torch")):
          algo = config.build()
          policy = algo.get_policy()
  
          train_batch = SampleBatch(FAKE_BATCH)
          train_batch = compute_gae_for_sample_batch(
              policy, train_batch
          )
  
          # convert to proper tensors with tree.map_structure
          if fw == "torch":
              train_batch = tree.map_structure(
                  lambda x: torch.as_tensor(x).float(), train_batch
              )
          else:
              train_batch = tree.map_structure(
                  lambda x: tf.convert_to_tensor(x), train_batch
              )
  
          algo_config = config.copy(copy_frozen=False)
          algo_config.validate()
          algo_config.freeze()
  
          learner_group = algo_config.build_learner_group(env=self.ENV)
  
          # Load the algo weights onto the learner_group.
          learner_group.set_weights(algo.get_weights())
          learner_group.update_from_batch(
              batch=train_batch.as_multi_agent()
          )
  
          algo.stop()
  
imports: import unittest
  import tempfile
  import gymnasium
  import numpy
  import tensorflow
  import torch
  import tree
  import ray
  import ray.rllib.algorithms.ppo
  from ray.rllib.algorithms.ppo.ppo import LEARNER_RESULTS_CURR_KL_COEFF_KEY
  from ray.rllib.examples.env.multi_agent import MultiAgentCartPole
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.tune.registry import register_env
  from ray.rllib.utils.metrics.learner_info import LEARNER_INFO
  from ray.rllib.utils.test_utils import check, framework_iterator
  from ray.rllib.evaluation.postprocessing import compute_gae_for_sample_batch
label_desc: Use image node_id 3 for calling the TestPPO obj's underlying member method code with example usage: obj.test_loss() without return types