class_docstr: The main tf-keras model containing all necessary components for DreamerV3.
  
  Includes:
  - The world model with encoder, decoder, sequence-model (RSSM), dynamics
  (generates prior z-state), and "posterior" model (generates posterior z-state).
  Predicts env dynamics and produces dreamed trajectories for actor- and critic
  learning.
  - The actor network (policy).
  - The critic network for value function prediction.
class_docstr_tok: ["The","main","tf-keras","model","containing","all","necessary","components","for","DreamerV3",".","Includes",":","-","The","world","model","with","encoder",",","decoder",",","sequence-model","(","RSSM",")",",","dynamics","(","generates","prior","z-state",")",",","and","``","posterior","''","model","(","generates","posterior","z-state",")",".","Predicts","env","dynamics","and","produces","dreamed","trajectories","for","actor-","and","critic","learning",".","-","The","actor","network","(","policy",")",".","-","The","critic","network","for","value","function","prediction","."]
docstr: Initializes a DreamerModel instance.
  
  Args:
       model_size: The "Model Size" used according to [1] Appendinx B.
          Use None for manually setting the different network sizes.
       action_space: The action space the our environment used.
       world_model: The WorldModel component.
       actor: The ActorNetwork component.
       critic: The CriticNetwork component.
       horizon: The dream horizon to use when creating dreamed trajectories.
docstr_tok: ["Initializes","a","DreamerModel","instance",".","Args",":","model_size",":","The","``","Model","Size","''","used","according","to","[","1","]","Appendinx","B",".","Use","None","for","manually","setting","the","different","network","sizes",".","action_space",":","The","action","space","the","our","environment","used",".","world_model",":","The","WorldModel","component",".","actor",":","The","ActorNetwork","component",".","critic",":","The","CriticNetwork","component",".","horizon",":","The","dream","horizon","to","use","when","creating","dreamed","trajectories","."]
code: def __init__(
      self,
      *,
      model_size: str = "XS",
      action_space: gym.Space,
      world_model: WorldModel,
      actor: ActorNetwork,
      critic: CriticNetwork,
      horizon: int,
      gamma: float,
      use_curiosity: bool = False,
      intrinsic_rewards_scale: float = 0.1,
  ):
      """Initializes a DreamerModel instance.
  
      Args:
           model_size: The "Model Size" used according to [1] Appendinx B.
              Use None for manually setting the different network sizes.
           action_space: The action space the our environment used.
           world_model: The WorldModel component.
           actor: The ActorNetwork component.
           critic: The CriticNetwork component.
           horizon: The dream horizon to use when creating dreamed trajectories.
      """
      super().__init__(name="dreamer_model")
  
      self.model_size = model_size
      self.action_space = action_space
      self.use_curiosity = use_curiosity
  
      self.world_model = world_model
      self.actor = actor
      self.critic = critic
  
      self.horizon = horizon
      self.gamma = gamma
      self._comp_dtype = (
          tf.keras.mixed_precision.global_policy().compute_dtype
          or tf.float32
      )
  
      self.disagree_nets = None
      if self.use_curiosity:
          self.disagree_nets = DisagreeNetworks(
              num_networks=8,
              model_size=self.model_size,
              intrinsic_rewards_scale=intrinsic_rewards_scale,
          )
  
      self.dream_trajectory = tf.function(
          input_signature=[
              {
                  "h": tf.TensorSpec(
                      shape=[
                          None,
                          get_gru_units(self.model_size),
                      ],
                      dtype=self._comp_dtype,
                  ),
                  "z": tf.TensorSpec(
                      shape=[
                          None,
                          get_num_z_categoricals(self.model_size),
                          get_num_z_classes(self.model_size),
                      ],
                      dtype=self._comp_dtype,
                  ),
              },
              tf.TensorSpec(shape=[None], dtype=tf.bool),
          ]
      )(self.dream_trajectory)
  
file_path: ray/python/ray/rllib/algorithms/dreamerv3/tf/models/dreamer_model.py
imports: import re
  import gymnasium
  import numpy
  from ray.rllib.algorithms.dreamerv3.tf.models.disagree_networks import DisagreeNetworks
  from ray.rllib.algorithms.dreamerv3.tf.models.actor_network import ActorNetwork
  from ray.rllib.algorithms.dreamerv3.tf.models.critic_network import CriticNetwork
  from ray.rllib.algorithms.dreamerv3.tf.models.world_model import WorldModel
  from ray.rllib.algorithms.dreamerv3.utils import get_gru_units, get_num_z_categoricals, get_num_z_classes
  from ray.rllib.utils.framework import try_import_tf
  from ray.rllib.utils.tf_utils import inverse_symlog
label_desc: Use image node_id 1 to create a new DreamerModel object from inherited base classes: tf.keras with example: obj = DreamerModel()