docstr: Checks the model's outputs for the given input space.
  
  Args:
      model: The model to check.
      framework: The framework to use (tf|torch).
      model_config_dict: The model config dict to use.
      input_space: The input space to use.
docstr_tok: ["Checks","the","model","'s","outputs","for","the","given","input","space",".","Args",":","model",":","The","model","to","check",".","framework",":","The","framework","to","use","(","tf|torch",")",".","model_config_dict",":","The","model","config","dict","to","use",".","input_space",":","The","input","space","to","use","."]
code: def _check_model_outputs(
      self, model, framework, model_config_dict, input_space
  ):
      """Checks the model's outputs for the given input space.
  
      Args:
          model: The model to check.
          framework: The framework to use (tf|torch).
          model_config_dict: The model config dict to use.
          input_space: The input space to use.
      """
      convert_method = (
          tf.convert_to_tensor
          if framework == "tf2"
          else convert_to_torch_tensor
      )
      expected_latent_dim = model_config_dict.get("latent_dim")
      if expected_latent_dim is None:
          # For CNNEncoders, `output_dims` are computed automatically.
          if isinstance(model.config, CNNEncoderConfig):
              expected_latent_dim = model.config.output_dims[0]
          # In order to stay backward compatible, we default to fcnet_hiddens[-1].
          # See MODEL_DEFAULTS for more details
          else:
              expected_latent_dim = model_config_dict["fcnet_hiddens"][
                  -1
              ]
      observations = convert_method(
          get_dummy_batch_for_space(input_space, batch_size=32)
      )
      states = tree.map_structure(
          lambda s: convert_method(32 * [s]), model.get_initial_state()
      )
      seq_lens = convert_method([32])
      inputs = {
          SampleBatch.OBS: observations,
          STATE_IN: states,
          SampleBatch.SEQ_LENS: seq_lens,
      }
      outputs = model(inputs)
  
      self.assertEqual(
          outputs[ENCODER_OUT].shape, (32, expected_latent_dim)
      )
      if STATE_OUT in outputs:
          tree.map_structure_with_path(
              lambda p, v: (
                  True
                  if v is None
                  else self.assertEqual(v.shape, states[p].shape)
              ),
              outputs[STATE_OUT],
          )
  
imports: from collections import namedtuple
  import functools
  import itertools
  import unittest
  import gymnasium
  from gymnasium.spaces import Box, Discrete, Dict, Tuple, MultiDiscrete
  import numpy
  import tree
  from ray.rllib.algorithms.ppo.ppo import PPOConfig
  from ray.rllib.algorithms.ppo.ppo_catalog import PPOCatalog
  from ray.rllib.algorithms.ppo.torch.ppo_torch_rl_module import PPOTorchRLModule
  from ray.rllib.core.models.base import Encoder, STATE_IN, ENCODER_OUT, STATE_OUT
  from ray.rllib.core.models.catalog import Catalog, _multi_action_dist_partial_helper, _multi_categorical_dist_partial_helper
  from ray.rllib.core.models.configs import MLPEncoderConfig, ModelConfig, CNNEncoderConfig
  from ray.rllib.core.models.torch.base import TorchModel
  from ray.rllib.core.rl_module.rl_module import SingleAgentRLModuleSpec
  from ray.rllib.models import MODEL_DEFAULTS
  from ray.rllib.models.tf.tf_distributions import TfCategorical, TfDiagGaussian, TfMultiCategorical, TfMultiDistribution
  from ray.rllib.models.torch.torch_distributions import TorchCategorical, TorchDiagGaussian, TorchMultiCategorical, TorchMultiDistribution
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.utils.framework import try_import_tf, try_import_torch
  from ray.rllib.utils.numpy import convert_to_numpy
  from ray.rllib.utils.spaces.space_utils import get_dummy_batch_for_space
  from ray.rllib.utils.test_utils import framework_iterator
  from ray.rllib.utils.torch_utils import convert_to_torch_tensor
label_desc: Use image node_id 1 for calling the TestCatalog obj's underlying member method code with example usage: obj._check_model_outputs(model, framework, model_config_dict, input_space) without return types