class_docstr: Defines an abstract neural network model for use with RLlib.
  
  Custom models should extend either TFModelV2 or TorchModelV2 instead of
  this class directly.
  
  Data flow:
      obs -> forward() -> model_out
          \-> value_function() -> V(s)
class_docstr_tok: ["Defines","an","abstract","neural","network","model","for","use","with","RLlib",".","Custom","models","should","extend","either","TFModelV2","or","TorchModelV2","instead","of","this","class","directly",".","Data","flow",":","obs","-",">","forward","(",")","-",">","model_out","\\-",">","value_function","(",")","-",">","V","(","s",")"]
docstr: Call the model with the given input tensors and state.
  
  Any complex observations (dicts, tuples, etc.) will be unpacked by
  __call__ before being passed to forward(). To access the flattened
  observation tensor, refer to input_dict["obs_flat"].
  
  This method can be called any number of times. In eager execution,
  each call to forward() will eagerly evaluate the model. In symbolic
  execution, each call to forward creates a computation graph that
  operates over the variables of this model (i.e., shares weights).
  
  Custom models should override this instead of __call__.
  
  Args:
      input_dict: dictionary of input tensors, including "obs",
          "obs_flat", "prev_action", "prev_reward", "is_training",
          "eps_id", "agent_id", "infos", and "t".
      state: list of state tensors with sizes matching those
          returned by get_initial_state + the batch dimension
      seq_lens: 1d tensor holding input sequence lengths
  
  Returns:
      A tuple consisting of the model output tensor of size
      [BATCH, num_outputs] and the list of new RNN state(s) if any.
  
  .. testcode::
      :skipif: True
  
      import numpy as np
      from ray.rllib.models.modelv2 import ModelV2
      class MyModel(ModelV2):
          # ...
          def forward(self, input_dict, state, seq_lens):
              model_out, self._value_out = self.base_model(
                  input_dict["obs"])
              return model_out, state
docstr_tok: ["Call","the","model","with","the","given","input","tensors","and","state",".","Any","complex","observations","(","dicts",",","tuples",",","etc",".",")","will","be","unpacked","by","__call__","before","being","passed","to","forward","(",")",".","To","access","the","flattened","observation","tensor",",","refer","to","input_dict","[","``","obs_flat","''","]",".","This","method","can","be","called","any","number","of","times",".","In","eager","execution",",","each","call","to","forward","(",")","will","eagerly","evaluate","the","model",".","In","symbolic","execution",",","each","call","to","forward","creates","a","computation","graph","that","operates","over","the","variables","of","this","model","(","i.e.",",","shares","weights",")",".","Custom","models","should","override","this","instead","of","__call__",".","Args",":","input_dict",":","dictionary","of","input","tensors",",","including","``","obs","''",",","``","obs_flat","''",",","``","prev_action","''",",","``","prev_reward","''",",","``","is_training","''",",","``","eps_id","''",",","``","agent_id","''",",","``","infos","''",",","and","``","t","''",".","state",":","list","of","state","tensors","with","sizes","matching","those","returned","by","get_initial_state","+","the","batch","dimension","seq_lens",":","1d","tensor","holding","input","sequence","lengths","Returns",":","A","tuple","consisting","of","the","model","output","tensor","of","size","[","BATCH",",","num_outputs","]","and","the","list","of","new","RNN","state","(","s",")","if","any",".","..","testcode",":",":",":","skipif",":","True","import","numpy","as","np","from","ray.rllib.models.modelv2","import","ModelV2","class","MyModel","(","ModelV2",")",":","#","...","def","forward","(","self",",","input_dict",",","state",",","seq_lens",")",":","model_out",",","self._value_out","=","self.base_model","(","input_dict","[","``","obs","''","]",")","return","model_out",",","state"]
code: def forward(
      self,
      input_dict: Dict[str, TensorType],
      state: List[TensorType],
      seq_lens: TensorType,
  ) -> (TensorType, List[TensorType]):
      """Call the model with the given input tensors and state.
  
      Any complex observations (dicts, tuples, etc.) will be unpacked by
      __call__ before being passed to forward(). To access the flattened
      observation tensor, refer to input_dict["obs_flat"].
  
      This method can be called any number of times. In eager execution,
      each call to forward() will eagerly evaluate the model. In symbolic
      execution, each call to forward creates a computation graph that
      operates over the variables of this model (i.e., shares weights).
  
      Custom models should override this instead of __call__.
  
      Args:
          input_dict: dictionary of input tensors, including "obs",
              "obs_flat", "prev_action", "prev_reward", "is_training",
              "eps_id", "agent_id", "infos", and "t".
          state: list of state tensors with sizes matching those
              returned by get_initial_state + the batch dimension
          seq_lens: 1d tensor holding input sequence lengths
  
      Returns:
          A tuple consisting of the model output tensor of size
          [BATCH, num_outputs] and the list of new RNN state(s) if any.
  
      .. testcode::
          :skipif: True
  
          import numpy as np
          from ray.rllib.models.modelv2 import ModelV2
          class MyModel(ModelV2):
              # ...
              def forward(self, input_dict, state, seq_lens):
                  model_out, self._value_out = self.base_model(
                      input_dict["obs"])
                  return model_out, state
      """
      raise NotImplementedError
  
imports: from collections import OrderedDict
  import contextlib
  import gymnasium
  from gymnasium.spaces import Space
  import numpy
  from typing import Dict, List, Any, Union
  from ray.rllib.models.preprocessors import get_preprocessor, RepeatedValuesPreprocessor
  from ray.rllib.models.repeated_values import RepeatedValues
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.policy.view_requirement import ViewRequirement
  from ray.rllib.utils import NullContextManager
  from ray.rllib.utils.annotations import DeveloperAPI, PublicAPI
  from ray.rllib.utils.deprecation import Deprecated
  from ray.rllib.utils.framework import try_import_tf, try_import_torch, TensorType
  from ray.rllib.utils.spaces.repeated import Repeated
  from ray.rllib.utils.typing import ModelConfigDict, ModelInputDict, TensorStructType
label_desc: Use image node_id 3 for calling the ModelV2 obj's underlying member method code with example usage: obj.forward(input_dict, state, seq_lens) without return types