class_docstr: The implementation of distill cross entropy loss.
  
  Args:
      weight (tuple|list|ndarray|Tensor, optional): A manual rescaling weight
          given to each class. Its length must be equal to the number of classes.
          Default ``None``.
      ignore_index (int64, optional): Specifies a target value that is ignored
          and does not contribute to the input gradient. Default ``255``.
      top_k_percent_pixels (float, optional): the value lies in [0.0, 1.0].
          When its value < 1.0, only compute the loss for the top k percent pixels
          (e.g., the top 20% pixels). This is useful for hard pixel mining.
          Default ``1.0``.
      data_format (str, optional): The tensor format to use, 'NCHW' or 'NHWC'.
          Default ``'NCHW'``.
class_docstr_tok: ["The","implementation","of","distill","cross","entropy","loss",".","Args",":","weight","(","tuple|list|ndarray|Tensor",",","optional",")",":","A","manual","rescaling","weight","given","to","each","class",".","Its","length","must","be","equal","to","the","number","of","classes",".","Default","``","None","``",".","ignore_index","(","int64",",","optional",")",":","Specifies","a","target","value","that","is","ignored","and","does","not","contribute","to","the","input","gradient",".","Default","``","255","``",".","top_k_percent_pixels","(","float",",","optional",")",":","the","value","lies","in","[","0.0",",","1.0","]",".","When","its","value","<","1.0",",","only","compute","the","loss","for","the","top","k","percent","pixels","(","e.g.",",","the","top","20","%","pixels",")",".","This","is","useful","for","hard","pixel","mining",".","Default","``","1.0","``",".","data_format","(","str",",","optional",")",":","The","tensor","format","to","use",",","'NCHW","'","or","'NHWC","'",".","Default","``","'NCHW","'","``","."]
docstr: Forward computation.
  
  Args:
      student_logit (Tensor): Logit tensor, the data type is float32, float64. Shape is
          (N, C), where C is number of classes, and if shape is more than 2D, this
          is (N, C, D1, D2,..., Dk), k >= 1.
      teacher_logit (Tensor): Logit tensor, the data type is float32, float64. The shape
          is the same as the student_logit.
      label (Tensor): Label tensor, the data type is int64. Shape is (N), where each
          value is 0 <= label[i] <= C-1, and if shape is more than 2D, this is
          (N, D1, D2,..., Dk), k >= 1.
      semantic_weights (Tensor, optional): Weights about loss for each pixels,
          shape is the same as label. Default: None.
docstr_tok: ["Forward","computation",".","Args",":","student_logit","(","Tensor",")",":","Logit","tensor",",","the","data","type","is","float32",",","float64",".","Shape","is","(","N",",","C",")",",","where","C","is","number","of","classes",",","and","if","shape","is","more","than","2D",",","this","is","(","N",",","C",",","D1",",","D2",",","...",",","Dk",")",",","k",">","=","1.","teacher_logit","(","Tensor",")",":","Logit","tensor",",","the","data","type","is","float32",",","float64",".","The","shape","is","the","same","as","the","student_logit",".","label","(","Tensor",")",":","Label","tensor",",","the","data","type","is","int64",".","Shape","is","(","N",")",",","where","each","value","is","0","<","=","label","[","i","]","<","=","C-1",",","and","if","shape","is","more","than","2D",",","this","is","(","N",",","D1",",","D2",",","...",",","Dk",")",",","k",">","=","1.","semantic_weights","(","Tensor",",","optional",")",":","Weights","about","loss","for","each","pixels",",","shape","is","the","same","as","label",".","Default",":","None","."]
code: def forward(
      self, student_logit, teacher_logit, label, semantic_weights=None
  ):
      """
      Forward computation.
  
      Args:
          student_logit (Tensor): Logit tensor, the data type is float32, float64. Shape is
              (N, C), where C is number of classes, and if shape is more than 2D, this
              is (N, C, D1, D2,..., Dk), k >= 1.
          teacher_logit (Tensor): Logit tensor, the data type is float32, float64. The shape
              is the same as the student_logit.
          label (Tensor): Label tensor, the data type is int64. Shape is (N), where each
              value is 0 <= label[i] <= C-1, and if shape is more than 2D, this is
              (N, D1, D2,..., Dk), k >= 1.
          semantic_weights (Tensor, optional): Weights about loss for each pixels,
              shape is the same as label. Default: None.
      """
  
      if student_logit.shape != teacher_logit.shape:
          raise ValueError(
              "The shape of student_logit = {} must be the same as the shape of teacher_logit = {}.".format(
                  student_logit.shape, teacher_logit.shape
              )
          )
  
      channel_axis = 1 if self.data_format == "NCHW" else -1
      if self.weight is not None and student_logit.shape[
          channel_axis
      ] != len(self.weight):
          raise ValueError(
              "The number of weights = {} must be the same as the number of classes = {}.".format(
                  len(self.weight), student_logit.shape[channel_axis]
              )
          )
  
      if channel_axis == 1:
          student_logit = paddle.transpose(student_logit, [0, 2, 3, 1])
          teacher_logit = paddle.transpose(teacher_logit, [0, 2, 3, 1])
  
      teacher_logit = F.softmax(teacher_logit)
  
      loss = F.cross_entropy(
          student_logit,
          teacher_logit,
          weight=self.weight,
          reduction="none",
          soft_label=True,
      )
  
      return self._post_process_loss(
          student_logit, label, semantic_weights, loss
      )
  
file_path: PaddleSeg/paddleseg/models/losses/cross_entropy_loss.py
imports: import paddle
  from paddle import nn
  import paddle.nn.functional
  from paddleseg.cvlibs import manager
label_desc: Use image node_id 2 for calling the DistillCrossEntropyLoss obj's underlying member method code with example usage: obj.forward(student_logit, teacher_logit, label, semantic_weights) and returns: self