code: def forward(self, parsing, edge, label):
      parsing_pre = torch.argmax(parsing, dim=1)
      parsing_pre[label == self.ignore_index] = self.ignore_index
      generated_edge = generate_edge_tensor(parsing_pre)
      edge_pre = torch.argmax(edge, dim=1)
      v_generate_edge = generated_edge[label != 255]
      v_edge_pre = edge_pre[label != 255]
      one = torch.ones_like(v_edge_pre)
      v_edge_pre = torch.where(v_edge_pre > 0, one, v_edge_pre)
      v_edge_pre = v_edge_pre.type(torch.cuda.FloatTensor)
      positive_union = (v_generate_edge == 1) & (
          v_edge_pre == 1
      )  # only the positive values count
      return F.smooth_l1_loss(
          v_generate_edge[positive_union].squeeze(0),
          v_edge_pre[positive_union].squeeze(0),
      )
  
file_path: insightface/parsing/dml_csr/loss/consistency_loss.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import torch
  import torch.nn.functional
  from torch import nn
label_desc: Use image node_id 2 for calling the ConsistencyLoss obj's underlying member method code with example usage: obj.forward(parsing, edge, label) and returns: F