class_docstr: Base class for detectors.
  
  Args:
     data_preprocessor (dict or ConfigDict, optional): The pre-process
         config of :class:`BaseDataPreprocessor`.  it usually includes,
          ``pad_size_divisor``, ``pad_value``, ``mean`` and ``std``.
     init_cfg (dict or ConfigDict, optional): the config to control the
         initialization. Defaults to None.
class_docstr_tok: ["Base","class","for","detectors",".","Args",":","data_preprocessor","(","dict","or","ConfigDict",",","optional",")",":","The","pre-process","config","of",":","class",":","`","BaseDataPreprocessor","`",".","it","usually","includes",",","``","pad_size_divisor","``",",","``","pad_value","``",",","``","mean","``","and","``","std","``",".","init_cfg","(","dict","or","ConfigDict",",","optional",")",":","the","config","to","control","the","initialization",".","Defaults","to","None","."]
docstr: The unified entry for a forward process in both training and test.
  
  The method should accept three modes: "tensor", "predict" and "loss":
  
  - "tensor": Forward the whole network and return tensor or tuple of
  tensor without any post-processing, same as a common nn.Module.
  - "predict": Forward and return the predictions, which are fully
  processed to a list of :obj:`DetDataSample`.
  - "loss": Forward and return a dict of losses according to the given
  inputs and data samples.
  
  Note that this method doesn't handle either back propagation or
  parameter update, which are supposed to be done in :meth:`train_step`.
  
  Args:
      inputs (torch.Tensor): The input tensor with shape
          (N, C, ...) in general.
      data_samples (list[:obj:`DetDataSample`], optional): A batch of
          data samples that contain annotations and predictions.
          Defaults to None.
      mode (str): Return what kind of value. Defaults to 'tensor'.
  
  Returns:
      The return type depends on ``mode``.
  
      - If ``mode="tensor"``, return a tensor or a tuple of tensor.
      - If ``mode="predict"``, return a list of :obj:`DetDataSample`.
      - If ``mode="loss"``, return a dict of tensor.
docstr_tok: ["The","unified","entry","for","a","forward","process","in","both","training","and","test",".","The","method","should","accept","three","modes",":","``","tensor","''",",","``","predict","''","and","``","loss","''",":","-","``","tensor","''",":","Forward","the","whole","network","and","return","tensor","or","tuple","of","tensor","without","any","post-processing",",","same","as","a","common","nn.Module",".","-","``","predict","''",":","Forward","and","return","the","predictions",",","which","are","fully","processed","to","a","list","of",":","obj",":","`","DetDataSample","`",".","-","``","loss","''",":","Forward","and","return","a","dict","of","losses","according","to","the","given","inputs","and","data","samples",".","Note","that","this","method","does","n't","handle","either","back","propagation","or","parameter","update",",","which","are","supposed","to","be","done","in",":","meth",":","`","train_step","`",".","Args",":","inputs","(","torch.Tensor",")",":","The","input","tensor","with","shape","(","N",",","C",",","...",")","in","general",".","data_samples","(","list","[",":","obj",":","`","DetDataSample","`","]",",","optional",")",":","A","batch","of","data","samples","that","contain","annotations","and","predictions",".","Defaults","to","None",".","mode","(","str",")",":","Return","what","kind","of","value",".","Defaults","to","'tensor","'",".","Returns",":","The","return","type","depends","on","``","mode","``",".","-","If","``","mode=","''","tensor","''","``",",","return","a","tensor","or","a","tuple","of","tensor",".","-","If","``","mode=","''","predict","''","``",",","return","a","list","of",":","obj",":","`","DetDataSample","`",".","-","If","``","mode=","''","loss","''","``",",","return","a","dict","of","tensor","."]
code: def forward(
      self,
      inputs: torch.Tensor,
      data_samples: OptSampleList = None,
      mode: str = "tensor",
  ) -> ForwardResults:
      """The unified entry for a forward process in both training and test.
  
      The method should accept three modes: "tensor", "predict" and "loss":
  
      - "tensor": Forward the whole network and return tensor or tuple of
      tensor without any post-processing, same as a common nn.Module.
      - "predict": Forward and return the predictions, which are fully
      processed to a list of :obj:`DetDataSample`.
      - "loss": Forward and return a dict of losses according to the given
      inputs and data samples.
  
      Note that this method doesn't handle either back propagation or
      parameter update, which are supposed to be done in :meth:`train_step`.
  
      Args:
          inputs (torch.Tensor): The input tensor with shape
              (N, C, ...) in general.
          data_samples (list[:obj:`DetDataSample`], optional): A batch of
              data samples that contain annotations and predictions.
              Defaults to None.
          mode (str): Return what kind of value. Defaults to 'tensor'.
  
      Returns:
          The return type depends on ``mode``.
  
          - If ``mode="tensor"``, return a tensor or a tuple of tensor.
          - If ``mode="predict"``, return a list of :obj:`DetDataSample`.
          - If ``mode="loss"``, return a dict of tensor.
      """
      if mode == "loss":
          return self.loss(inputs, data_samples)
      elif mode == "predict":
          return self.predict(inputs, data_samples)
      elif mode == "tensor":
          return self._forward(inputs, data_samples)
      else:
          raise RuntimeError(
              f'Invalid mode "{mode}". '
              "Only supports loss, predict and tensor mode"
          )
  
imports: from abc import ABCMeta, abstractmethod
  from typing import Dict, List, Tuple, Union
  import torch
  from mmengine.model import BaseModel
  from torch import Tensor
  from mmdet.structures import DetDataSample, OptSampleList, SampleList
  from mmdet.utils import InstanceList, OptConfigType, OptMultiConfig
  from ..utils import samplelist_boxtype2tensor
label_desc: Use image node_id 6 for calling the BaseDetector obj's underlying member method code with example usage: obj.forward(inputs, data_samples, mode) and returns: self, self, self