class_docstr: The `actor` (policy net) of DreamerV3.
  
  Consists of a simple MLP for Discrete actions and two MLPs for cont. actions (mean
  and stddev).
  Also contains two scalar variables to keep track of the percentile-5 and
  percentile-95 values of the computed value targets within a batch. This is used to
  compute the "scaled value targets" for actor learning. These two variables decay
  over time exponentially (see [1] for more details).
docstr: Performs a forward pass through this policy network.
  
  Args:
      h: The deterministic hidden state of the sequence model. [B, dim(h)].
      z: The stochastic discrete representations of the original
          observation input. [B, num_categoricals, num_classes].
code: def call(self, h, z):
      """Performs a forward pass through this policy network.
  
      Args:
          h: The deterministic hidden state of the sequence model. [B, dim(h)].
          z: The stochastic discrete representations of the original
              observation input. [B, num_categoricals, num_classes].
      """
      # Flatten last two dims of z.
      assert len(z.shape) == 3
      z_shape = tf.shape(z)
      z = tf.reshape(z, shape=(z_shape[0], -1))
      assert len(z.shape) == 2
      out = tf.concat([h, z], axis=-1)
      out.set_shape(
          [
              None,
              (
                  get_num_z_categoricals(self.model_size)
                  * get_num_z_classes(self.model_size)
                  + get_gru_units(self.model_size)
              ),
          ]
      )
      # Send h-cat-z through MLP.
      action_logits = tf.cast(self.mlp(out), tf.float32)
  
      if isinstance(self.action_space, Discrete):
          action_probs = tf.nn.softmax(action_logits)
  
          # Add the unimix weighting (1% uniform) to the probs.
          # See [1]: "Unimix categoricals: We parameterize the categorical
          # distributions for the world model representations and dynamics, as well as
          # for the actor network, as mixtures of 1% uniform and 99% neural network
          # output to ensure a minimal amount of probability mass on every class and
          # thus keep log probabilities and KL divergences well behaved."
          action_probs = 0.99 * action_probs + 0.01 * (
              1.0 / self.action_space.n
          )
  
          # Danijar's code does: distr = [Distr class](logits=tf.log(probs)).
          # Not sure why we don't directly use the already available probs instead.
          action_logits = tf.math.log(action_probs)
  
          # Distribution parameters are the log(probs) directly.
          distr_params = action_logits
          distr = self.get_action_dist_object(distr_params)
  
          action = tf.stop_gradient(distr.sample()) + (
              action_probs - tf.stop_gradient(action_probs)
          )
  
      elif isinstance(self.action_space, Box):
          # Send h-cat-z through MLP to compute stddev logits for Normal dist
          std_logits = tf.cast(self.std_mlp(out), tf.float32)
          # minstd, maxstd taken from [1] from configs.yaml
          minstd = 0.1
          maxstd = 1.0
  
          # Distribution parameters are the squashed std_logits and the tanh'd
          # mean logits.
          # squash std_logits from (-inf, inf) to (minstd, maxstd)
          std_logits = (maxstd - minstd) * tf.sigmoid(
              std_logits + 2.0
          ) + minstd
          mean_logits = tf.tanh(action_logits)
  
          distr_params = tf.concat([mean_logits, std_logits], axis=-1)
          distr = self.get_action_dist_object(distr_params)
  
          action = distr.sample()
  
      return action, distr_params
  
file_path: ray/python/ray/rllib/algorithms/dreamerv3/tf/models/actor_network.py
imports: from typing import Optional
  import gymnasium
  from gymnasium.spaces import Box, Discrete
  import numpy
  from ray.rllib.algorithms.dreamerv3.tf.models.components.mlp import MLP
  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, try_import_tfp
label_desc: Use image node_id 2 for calling the ActorNetwork obj's underlying member method code with example usage: obj.call(h, z) and returns: action,  distr_params