class_docstr: Base class for text spotter.
  
  TODO: Refine docstr & typehint
  
  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 or List[dict], optional): the config
          to control the initialization. Defaults to None.
class_docstr_tok: ["Base","class","for","text","spotter",".","TODO",":","Refine","docstr","&","typehint","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","or","List","[","dict","]",",","optional",")",":","the","config","to","control","the","initialization",".","Defaults","to","None","."]
docstr: Calculate losses from a batch of inputs and data samples.
docstr_tok: ["Calculate","losses","from","a","batch","of","inputs","and","data","samples","."]
code: def loss(
      self, inputs: torch.Tensor, data_samples: RecSampleList, **kwargs
  ) -> Union[dict, tuple]:
      """Calculate losses from a batch of inputs and data samples."""
      pass
  
file_path: mmocr/projects/SPTS/spts/model/base_text_spotter.py
imports: from abc import ABCMeta, abstractmethod
  from typing import Union
  import torch
  from mmengine.model.base_model import BaseModel
  from mmocr.utils import OptConfigType, OptMultiConfig, OptRecSampleList, RecForwardResults, RecSampleList
label_desc: Use image node_id 8 for calling the BaseTextSpotter obj's underlying member method code with example usage: obj.loss(inputs, data_samples) without return types