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: Convenience function that calls this model with a tensor batch.
  
  All this does is unpack the tensor batch to call this model with the
  right input dict, state, and seq len arguments.
docstr_tok: ["Convenience","function","that","calls","this","model","with","a","tensor","batch",".","All","this","does","is","unpack","the","tensor","batch","to","call","this","model","with","the","right","input","dict",",","state",",","and","seq","len","arguments","."]
code: def from_batch(
      self, train_batch: SampleBatch, is_training: bool = True
  ) -> (TensorType, List[TensorType]):
      """Convenience function that calls this model with a tensor batch.
  
      All this does is unpack the tensor batch to call this model with the
      right input dict, state, and seq len arguments.
      """
  
      input_dict = train_batch.copy()
      input_dict.set_training(is_training)
      states = []
      i = 0
      while "state_in_{}".format(i) in input_dict:
          states.append(input_dict["state_in_{}".format(i)])
          i += 1
      ret = self.__call__(
          input_dict, states, input_dict.get(SampleBatch.SEQ_LENS)
      )
      return ret
  
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 14 for calling the ModelV2 obj's underlying member method code with example usage: obj.from_batch(train_batch, is_training) and returns: ret