code: def test__trajectory_to_losses(self):
      inp = PolicyGradientInput.input_prototype(
          batch_size=self.batch_size,
          action_dim=self.action_dim,
          state_dim=self.state_dim,
      )
      # Normalize + offset clamp min
      params = PPOTrainerParameters(
          actions=["1", "2"], normalize=True, offset_clamp_min=True
      )
      trainer = self._construct_trainer(
          new_params=params, use_value_net=False
      )
      losses = trainer._trajectory_to_losses(inp)
      self.assertEqual(len(losses), 1)
      self.assertTrue("ppo_loss" in losses)
  
      trainer = self._construct_trainer()
      losses = trainer._trajectory_to_losses(inp)
      self.assertEqual(len(losses), 2)
      self.assertTrue(
          "ppo_loss" in losses and "value_net_loss" in losses
      )
      # entropy weight should always lower ppo_loss
      trainer.entropy_weight = 1.0
      entropy_losses = trainer._trajectory_to_losses(inp)
      self.assertTrue(entropy_losses["ppo_loss"] < losses["ppo_loss"])
  
imports: import unittest
  from collections import defaultdict
  from unittest import mock
  import torch
  from reagent.core.types import PolicyGradientInput
  from reagent.evaluation.evaluator import get_metrics_to_score
  from reagent.gym.policies.policy import Policy
  from reagent.gym.policies.samplers.discrete_sampler import SoftmaxActionSampler
  from reagent.models.dueling_q_network import DuelingQNetwork
  from reagent.models.fully_connected_network import FloatFeatureFullyConnected
  from reagent.training.parameters import PPOTrainerParameters
  from reagent.training.ppo_trainer import PPOTrainer
  from reagent.workflow.types import RewardOptions
label_desc: Use image node_id 4 for calling the TestPPO obj's underlying member method code with example usage: obj.test__trajectory_to_losses() without return types