class_docstr: Implements DreamerV3 losses and gradient-based update logic in TensorFlow.
  
  The critic EMA-copy update step can be found in the `DreamerV3Learner` base class,
  as it is framework independent.
  
  We define 3 local TensorFlow optimizers for the sub components "world_model",
  "actor", and "critic". Each of these optimizers might use a different learning rate,
  epsilon parameter, and gradient clipping thresholds and procedures.
docstr: Performs gradient clipping on the 3 module components' computed grads.
  
  Note that different grad global-norm clip values are used for the 3
  module components: world model, actor, and critic.
docstr_tok: ["Performs","gradient","clipping","on","the","3","module","components","'","computed","grads",".","Note","that","different","grad","global-norm","clip","values","are","used","for","the","3","module","components",":","world","model",",","actor",",","and","critic","."]
code: def postprocess_gradients_for_module(
      self,
      *,
      module_id: ModuleID,
      config: DreamerV3Config,
      module_gradients_dict: Dict[str, Any],
  ) -> ParamDict:
      """Performs gradient clipping on the 3 module components' computed grads.
  
      Note that different grad global-norm clip values are used for the 3
      module components: world model, actor, and critic.
      """
      for optimizer_name, optimizer in self.get_optimizers_for_module(
          module_id=module_id
      ):
          grads_sub_dict = self.filter_param_dict_for_optimizer(
              module_gradients_dict, optimizer
          )
          # Figure out, which grad clip setting to use.
          grad_clip = (
              config.world_model_grad_clip_by_global_norm
              if optimizer_name == "world_model"
              else config.actor_grad_clip_by_global_norm
              if optimizer_name == "actor"
              else config.critic_grad_clip_by_global_norm
          )
          global_norm = clip_gradients(
              grads_sub_dict,
              grad_clip=grad_clip,
              grad_clip_by="global_norm",
          )
          module_gradients_dict.update(grads_sub_dict)
  
          # DreamerV3 stats have the format: [WORLD_MODEL|ACTOR|CRITIC]_[stats name].
          self.register_metric(
              module_id,
              optimizer_name.upper() + "_gradients_global_norm",
              global_norm,
          )
          self.register_metric(
              module_id,
              optimizer_name.upper()
              + "_gradients_maxabs_after_clipping",
              tf.reduce_max(
                  [
                      tf.reduce_max(tf.math.abs(g))
                      for g in grads_sub_dict.values()
                  ]
              ),
          )
  
      return module_gradients_dict
  
imports: from typing import Any, Dict, Tuple
  import gymnasium
  from ray.rllib.algorithms.dreamerv3.dreamerv3 import DreamerV3Config
  from ray.rllib.algorithms.dreamerv3.dreamerv3_learner import DreamerV3Learner
  from ray.rllib.core.learner.learner import ParamDict
  from ray.rllib.core.learner.tf.tf_learner import TfLearner
  from ray.rllib.policy.sample_batch import DEFAULT_POLICY_ID, SampleBatch
  from ray.rllib.utils.annotations import override
  from ray.rllib.utils.deprecation import deprecation_warning
  from ray.rllib.utils.framework import try_import_tf, try_import_tfp
  from ray.rllib.utils.tf_utils import symlog, two_hot, clip_gradients
  from ray.rllib.utils.typing import ModuleID, TensorType
label_desc: Use image node_id 2 for calling the DreamerV3TfLearner obj's underlying member method code with example usage: obj.postprocess_gradients_for_module() and returns: module_gradients_dict