class_docstr: Generic vision network.
class_docstr_tok: ["Generic","vision","network","."]
code: def forward(
      self,
      input_dict: Dict[str, TensorType],
      state: List[TensorType],
      seq_lens: TensorType,
  ) -> (TensorType, List[TensorType]):
      self._features = input_dict["obs"].float()
      # Permuate b/c data comes in as [B, dim, dim, channels]:
      self._features = self._features.permute(0, 3, 1, 2)
      conv_out = self._convs(self._features)
      # Store features to save forward pass when getting value_function out.
      if not self._value_branch_separate:
          self._features = conv_out
  
      if not self.last_layer_is_flattened:
          if self._logits:
              conv_out = self._logits(conv_out)
          if len(conv_out.shape) == 4:
              if conv_out.shape[2] != 1 or conv_out.shape[3] != 1:
                  raise ValueError(
                      "Given `conv_filters` ({}) do not result in a [B, {} "
                      "(`num_outputs`), 1, 1] shape (but in {})! Please "
                      "adjust your Conv2D stack such that the last 2 dims "
                      "are both 1.".format(
                          self.model_config["conv_filters"],
                          self.num_outputs,
                          list(conv_out.shape),
                      )
                  )
              logits = conv_out.squeeze(3)
              logits = logits.squeeze(2)
          else:
              logits = conv_out
          return logits, state
      else:
          return conv_out, state
  
file_path: ray/python/ray/rllib/models/torch/visionnet.py
imports: import numpy
  from typing import Dict, List
  import gymnasium
  from ray.rllib.models.torch.torch_modelv2 import TorchModelV2
  from ray.rllib.models.torch.misc import normc_initializer, same_padding, SlimConv2d, SlimFC
  from ray.rllib.models.utils import get_activation_fn, get_filter_config
  from ray.rllib.utils.annotations import override
  from ray.rllib.utils.framework import try_import_torch
  from ray.rllib.utils.typing import ModelConfigDict, TensorType
label_desc: Use image node_id 2 for calling the VisionNetwork obj's underlying member method code with example usage: obj.forward(input_dict, state, seq_lens) and returns: logits,  state, conv_out,  state