class_docstr: PyTorch policy class used with Impala.
class_docstr_tok: ["PyTorch","policy","class","used","with","Impala","."]
code: def postprocess_trajectory(
      self,
      sample_batch: SampleBatch,
      other_agent_batches: Optional[SampleBatch] = None,
      episode: Optional["Episode"] = None,
  ):
      # Call super's postprocess_trajectory first.
      # sample_batch = super().postprocess_trajectory(
      #    sample_batch, other_agent_batches, episode
      # )
  
      if self.config["vtrace"]:
          # Add the SampleBatch.VALUES_BOOTSTRAPPED column, which we'll need
          # inside the loss for vtrace calculations.
          sample_batch = compute_bootstrap_value(sample_batch, self)
  
      return sample_batch
  
imports: import gymnasium
  import logging
  import numpy
  from typing import Dict, List, Optional, Type, Union
  import ray
  from ray.rllib.evaluation.episode import Episode
  from ray.rllib.evaluation.postprocessing import compute_bootstrap_value
  from ray.rllib.models.modelv2 import ModelV2
  from ray.rllib.models.action_dist import ActionDistribution
  from ray.rllib.models.torch.torch_action_dist import TorchCategorical
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.policy.torch_mixins import EntropyCoeffSchedule, LearningRateSchedule, ValueNetworkMixin
  from ray.rllib.policy.torch_policy_v2 import TorchPolicyV2
  from ray.rllib.utils.annotations import override
  from ray.rllib.utils.framework import try_import_torch
  from ray.rllib.utils.numpy import convert_to_numpy
  from ray.rllib.utils.torch_utils import apply_grad_clipping, explained_variance, global_norm, sequence_mask
  from ray.rllib.utils.typing import TensorType
label_desc: Use image node_id 4 for calling the ImpalaTorchPolicy obj's underlying member method code with example usage: obj.postprocess_trajectory(sample_batch, other_agent_batches, episode) and returns: sample_batch