class_docstr: Implementation of `LAD <https://arxiv.org/pdf/2108.10520.pdf>`_.
docstr: Args:
      batch_inputs (Tensor): Input images of shape (N, C, H, W).
          These should usually be mean centered and std scaled.
      batch_data_samples (list[:obj:`DetDataSample`]): The batch
          data samples. It usually includes information such
          as `gt_instance` or `gt_panoptic_seg` or `gt_sem_seg`.
  
  Returns:
      dict[str, Tensor]: A dictionary of loss components.
docstr_tok: ["Args",":","batch_inputs","(","Tensor",")",":","Input","images","of","shape","(","N",",","C",",","H",",","W",")",".","These","should","usually","be","mean","centered","and","std","scaled",".","batch_data_samples","(","list","[",":","obj",":","`","DetDataSample","`","]",")",":","The","batch","data","samples",".","It","usually","includes","information","such","as","`","gt_instance","`","or","`","gt_panoptic_seg","`","or","`","gt_sem_seg","`",".","Returns",":","dict","[","str",",","Tensor","]",":","A","dictionary","of","loss","components","."]
code: def loss(
      self, batch_inputs: Tensor, batch_data_samples: SampleList
  ) -> dict:
      """
      Args:
          batch_inputs (Tensor): Input images of shape (N, C, H, W).
              These should usually be mean centered and std scaled.
          batch_data_samples (list[:obj:`DetDataSample`]): The batch
              data samples. It usually includes information such
              as `gt_instance` or `gt_panoptic_seg` or `gt_sem_seg`.
  
      Returns:
          dict[str, Tensor]: A dictionary of loss components.
      """
      outputs = unpack_gt_instances(batch_data_samples)
      (
          batch_gt_instances,
          batch_gt_instances_ignore,
          batch_img_metas,
      ) = outputs
      # get label assignment from the teacher
      with torch.no_grad():
          x_teacher = self.extract_teacher_feat(batch_inputs)
          outs_teacher = self.teacher_model.bbox_head(x_teacher)
          label_assignment_results = (
              self.teacher_model.bbox_head.get_label_assignment(
                  *outs_teacher,
                  batch_gt_instances,
                  batch_img_metas,
                  batch_gt_instances_ignore,
              )
          )
  
      # the student use the label assignment from the teacher to learn
      x = self.extract_feat(batch_inputs)
      losses = self.bbox_head.loss(
          x, label_assignment_results, batch_data_samples
      )
      return losses
  
file_path: mmdetection/mmdet/models/detectors/lad.py
imports: from typing import Optional
  import torch
  import torch.nn
  from mmengine.runner import load_checkpoint
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.utils import ConfigType, OptConfigType
  from ..utils.misc import unpack_gt_instances
  from .kd_one_stage import KnowledgeDistillationSingleStageDetector
label_desc: Use image node_id 4 for calling the LAD obj's underlying member method code with example usage: obj.loss(batch_inputs, batch_data_samples) and returns: losses