class_docstr: Loss function for knowledge distilling using KL divergence.
  
  Args:
      reduction (str): Options are `'none'`, `'mean'` and `'sum'`.
      loss_weight (float): Loss weight of current loss.
      T (int): Temperature for distillation.
class_docstr_tok: ["Loss","function","for","knowledge","distilling","using","KL","divergence",".","Args",":","reduction","(","str",")",":","Options","are","`","'none","'","`",",","`","'mean","'","`","and","`","'sum","'","`",".","loss_weight","(","float",")",":","Loss","weight","of","current","loss",".","T","(","int",")",":","Temperature","for","distillation","."]
docstr: Loss function for knowledge distilling using KL divergence.
  
  Args:
      pred (Tensor): Predicted logits with shape (N, n + 1).
      soft_label (Tensor): Target logits with shape (N, N + 1).
      T (int): Temperature for distillation.
      detach_target (bool): Remove soft_label from automatic differentiation
docstr_tok: ["Loss","function","for","knowledge","distilling","using","KL","divergence",".","Args",":","pred","(","Tensor",")",":","Predicted","logits","with","shape","(","N",",","n","+","1",")",".","soft_label","(","Tensor",")",":","Target","logits","with","shape","(","N",",","N","+","1",")",".","T","(","int",")",":","Temperature","for","distillation",".","detach_target","(","bool",")",":","Remove","soft_label","from","automatic","differentiation"]
code: def knowledge_distillation_kl_div_loss(
      self, pred, soft_label, T, detach_target=True
  ):
      r"""Loss function for knowledge distilling using KL divergence.
  
      Args:
          pred (Tensor): Predicted logits with shape (N, n + 1).
          soft_label (Tensor): Target logits with shape (N, N + 1).
          T (int): Temperature for distillation.
          detach_target (bool): Remove soft_label from automatic differentiation
      """
      assert pred.shape == soft_label.shape
      target = F.softmax(soft_label / T, axis=1)
      if detach_target:
          target = target.detach()
  
      kd_loss = F.kl_div(
          F.log_softmax(pred / T, axis=1), target, reduction="none"
      ).mean(1) * (T * T)
  
      return kd_loss
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle import ParamAttr
  from ppdet.core.workspace import register
  from ppdet.modeling import ops
  from ppdet.modeling.losses.iou_loss import GIoULoss
  from ppdet.utils.logger import setup_logger
label_desc: Use image node_id 2 for calling the KnowledgeDistillationKLDivLoss obj's underlying member method code with example usage: obj.knowledge_distillation_kl_div_loss(pred, soft_label, T, detach_target) and returns: kd_loss