class_docstr: An LSTM wrapper serving as an interface for ModelV2s that set use_lstm.
code: def forward_rnn(
      self,
      inputs: TensorType,
      state: List[TensorType],
      seq_lens: TensorType,
  ) -> Tuple[TensorType, List[TensorType]]:
      # Don't show paddings to RNN(?)
      # TODO: (sven) For now, only allow, iff time_major=True to not break
      #  anything retrospectively (time_major not supported previously).
      # max_seq_len = inputs.shape[0]
      # time_major = self.model_config["_time_major"]
      # if time_major and max_seq_len > 1:
      #     inputs = torch.nn.utils.rnn.pack_padded_sequence(
      #         inputs, seq_lens,
      #         batch_first=not time_major, enforce_sorted=False)
      self._features, [h, c] = self.lstm(
          inputs,
          [torch.unsqueeze(state[0], 0), torch.unsqueeze(state[1], 0)],
      )
      # Re-apply paddings.
      # if time_major and max_seq_len > 1:
      #     self._features, _ = torch.nn.utils.rnn.pad_packed_sequence(
      #         self._features,
      #         batch_first=not time_major)
      model_out = self._logits_branch(self._features)
      return model_out, [torch.squeeze(h, 0), torch.squeeze(c, 0)]
  
imports: import numpy
  import gymnasium
  from gymnasium.spaces import Discrete, MultiDiscrete
  import tree
  from typing import Dict, List, Union, Tuple
  from ray.rllib.models.modelv2 import ModelV2
  from ray.rllib.models.torch.misc import SlimFC
  from ray.rllib.models.torch.torch_modelv2 import TorchModelV2
  from ray.rllib.policy.rnn_sequencing import add_time_dimension
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.policy.view_requirement import ViewRequirement
  from ray.rllib.utils.annotations import override, DeveloperAPI
  from ray.rllib.utils.framework import try_import_torch
  from ray.rllib.utils.spaces.space_utils import get_base_struct_from_space
  from ray.rllib.utils.torch_utils import flatten_inputs_to_1d_tensor, one_hot
  from ray.rllib.utils.typing import ModelConfigDict, TensorType
  from ray.rllib.utils.deprecation import deprecation_warning
  from ray.util.debug import log_once
label_desc: Use image node_id 3 for calling the LSTMWrapper obj's underlying member method code with example usage: obj.forward_rnn(inputs, state, seq_lens) and returns: model_out,  list