class_docstr: Base class for detectors.
docstr: The iteration step during training.
  
  This method defines an iteration step during training, except for the
  back propagation and optimizer updating, which are done in an optimizer
  hook. Note that in some complicated cases or models, the whole process
  including back propagation and optimizer updating is also defined in
  this method, such as GAN.
  
  Args:
      data (dict): The output of dataloader.
      optimizer (:obj:`torch.optim.Optimizer` | dict): The optimizer of
          runner is passed to ``train_step()``. This argument is unused
          and reserved.
  
  Returns:
      dict: It should contain at least 3 keys: ``loss``, ``log_vars``,                 ``num_samples``.
  
          - ``loss`` is a tensor for back propagation, which can be a                 weighted sum of multiple losses.
          - ``log_vars`` contains all the variables to be sent to the
          logger.
          - ``num_samples`` indicates the batch size (when the model is                 DDP, it means the batch size on each GPU), which is used for                 averaging the logs.
docstr_tok: ["The","iteration","step","during","training",".","This","method","defines","an","iteration","step","during","training",",","except","for","the","back","propagation","and","optimizer","updating",",","which","are","done","in","an","optimizer","hook",".","Note","that","in","some","complicated","cases","or","models",",","the","whole","process","including","back","propagation","and","optimizer","updating","is","also","defined","in","this","method",",","such","as","GAN",".","Args",":","data","(","dict",")",":","The","output","of","dataloader",".","optimizer","(",":","obj",":","`","torch.optim.Optimizer","`","|","dict",")",":","The","optimizer","of","runner","is","passed","to","``","train_step","(",")","``",".","This","argument","is","unused","and","reserved",".","Returns",":","dict",":","It","should","contain","at","least","3","keys",":","``","loss","``",",","``","log_vars","``",",","``","num_samples","``",".","-","``","loss","``","is","a","tensor","for","back","propagation",",","which","can","be","a","weighted","sum","of","multiple","losses",".","-","``","log_vars","``","contains","all","the","variables","to","be","sent","to","the","logger",".","-","``","num_samples","``","indicates","the","batch","size","(","when","the","model","is","DDP",",","it","means","the","batch","size","on","each","GPU",")",",","which","is","used","for","averaging","the","logs","."]
code: def train_step(self, data, optimizer):
      """The iteration step during training.
  
          This method defines an iteration step during training, except for the
          back propagation and optimizer updating, which are done in an optimizer
          hook. Note that in some complicated cases or models, the whole process
          including back propagation and optimizer updating is also defined in
          this method, such as GAN.
  
          Args:
              data (dict): The output of dataloader.
              optimizer (:obj:`torch.optim.Optimizer` | dict): The optimizer of
                  runner is passed to ``train_step()``. This argument is unused
                  and reserved.
  
          Returns:
              dict: It should contain at least 3 keys: ``loss``, ``log_vars``, \
                  ``num_samples``.
  
                  - ``loss`` is a tensor for back propagation, which can be a \
                  weighted sum of multiple losses.
                  - ``log_vars`` contains all the variables to be sent to the
                  logger.
                  - ``num_samples`` indicates the batch size (when the model is \
                  DDP, it means the batch size on each GPU), which is used for \
                  averaging the logs.
          """
      losses = self(**data)
      loss, log_vars = self._parse_losses(losses)
  
      outputs = dict(
          loss=loss,
          log_vars=log_vars,
          num_samples=len(data["img_metas"]),
      )
  
      return outputs
  
imports: from abc import ABCMeta, abstractmethod
  from collections import OrderedDict
  import mmcv
  import numpy
  import torch
  import torch.distributed
  import torch.nn
  from mmcv.runner import auto_fp16
  from mmcv.utils import print_log
  from mmdet.utils import get_root_logger
label_desc: Use image node_id 15 for calling the BaseDetector obj's underlying member method code with example usage: obj.train_step(data, optimizer) and returns: outputs