class_docstr: PyTorch policy class used with Marwil.
class_docstr_tok: ["PyTorch","policy","class","used","with","Marwil","."]
code: def __init__(self, observation_space, action_space, config):
      TorchPolicyV2.__init__(
          self,
          observation_space,
          action_space,
          config,
          max_seq_len=config["model"]["max_seq_len"],
      )
  
      ValueNetworkMixin.__init__(self, config)
      PostprocessAdvantages.__init__(self)
  
      # Not needed for pure BC.
      if config["beta"] != 0.0:
          # Set up a torch-var for the squared moving avg. advantage norm.
          self._moving_average_sqd_adv_norm = torch.tensor(
              [config["moving_average_sqd_adv_norm_start"]],
              dtype=torch.float32,
              requires_grad=False,
          ).to(self.device)
  
      # TODO: Don't require users to call this manually.
      self._initialize_loss_from_dummy_batch()
  
imports: from typing import Dict, List, Type, Union
  from ray.rllib.algorithms.marwil.marwil_tf_policy import PostprocessAdvantages
  from ray.rllib.evaluation.postprocessing import Postprocessing
  from ray.rllib.models.modelv2 import ModelV2
  from ray.rllib.models.torch.torch_action_dist import TorchDistributionWrapper
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.policy.torch_mixins import 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
  from ray.rllib.utils.typing import TensorType
label_desc: Use image node_id 1 to create a new MARWILTorchPolicy object from inherited base classes: ValueNetworkMixin, PostprocessAdvantages, TorchPolicyV2 with example: obj = MARWILTorchPolicy(observation_space, action_space, config)