code: def forward(self, x: torch.Tensor) -> Dict[str, torch.Tensor]:
      detection_sources, head_list = [], []
  
      x = self.model0(x)
      x = F.max_pool2d(x, 2)
      x = self.model1(x)
      x = self.model2(x)
      x = F.max_pool2d(x, 2)
      x = self.model3(x)
      detection_sources.append(x)
  
      x = F.max_pool2d(x, 2)
      x = self.model4(x)
      detection_sources.append(x)
  
      x = F.max_pool2d(x, 2)
      x = self.model5(x)
      detection_sources.append(x)
  
      x = F.max_pool2d(x, 2)
      x = self.model6(x)
      detection_sources.append(x)
  
      for i, h in enumerate(self.head):
          x_tmp = h(detection_sources[i])
          head_list.append(x_tmp.permute(0, 2, 3, 1).contiguous())
  
      head_data = torch.cat(
          [o.view(o.size(0), -1) for o in head_list], 1
      )
      head_data = head_data.view(head_data.size(0), -1, 17)
  
      loc_data, conf_data, iou_data = head_data.split(
          (14, 2, 1), dim=-1
      )
  
      if self.phase == "test":
          conf_data = torch.softmax(conf_data, dim=-1)
      else:
          loc_data = loc_data.view(loc_data.size(0), -1, 14)
          conf_data = conf_data.view(
              conf_data.size(0), -1, self.num_classes
          )
          iou_data = iou_data.view(iou_data.size(0), -1, 1)
  
      return {"loc": loc_data, "conf": conf_data, "iou": iou_data}
  
imports: import math
  from enum import Enum
  from typing import Dict, List, Optional, Tuple
  import torch
  import torch.nn.functional
  from torch import nn
  from kornia.geometry.bbox import nms
  from kornia.utils.helpers import map_location_to_cpu
label_desc: Use image node_id 2 for calling the YuFaceDetectNet obj's underlying member method code with example usage: obj.forward(x) and returns: dict