class_docstr: Implements the loss as the sum of the followings:
  1. Confidence Loss: All labels, with hard negative mining
  2. Localization Loss: Only on positive labels
  Suppose input dboxes has the shape 8732x4
class_docstr_tok: ["Implements","the","loss","as","the","sum","of","the","followings",":","1",".","Confidence","Loss",":","All","labels",",","with","hard","negative","mining","2",".","Localization","Loss",":","Only","on","positive","labels","Suppose","input","dboxes","has","the","shape","8732x4"]
docstr: Generate Location Vectors
  计算ground truth相对anchors的回归参数
  :param loc: anchor匹配到的对应GTBOX Nx4x8732
  :return:
docstr_tok: ["Generate","Location","Vectors","\u8ba1\u7b97ground","truth\u76f8\u5bf9anchors\u7684\u56de\u5f52\u53c2\u6570",":","param","loc",":","anchor\u5339\u914d\u5230\u7684\u5bf9\u5e94GTBOX","Nx4x8732",":","return",":"]
code: def _location_vec(self, loc):
      # type: (Tensor) -> Tensor
      """
      Generate Location Vectors
      计算ground truth相对anchors的回归参数
      :param loc: anchor匹配到的对应GTBOX Nx4x8732
      :return:
      """
      gxy = (
          self.scale_xy
          * (loc[:, :2, :] - self.dboxes[:, :2, :])
          / self.dboxes[:, 2:, :]
      )  # Nx2x8732
      gwh = (
          self.scale_wh * (loc[:, 2:, :] / self.dboxes[:, 2:, :]).log()
      )  # Nx2x8732
      return torch.cat((gxy, gwh), dim=1).contiguous()
  
imports: import torch
  from torch import nn, Tensor
  from torch.jit.annotations import List
  from .res50_backbone import resnet50
  from .utils import dboxes300_coco, Encoder, PostProcess
label_desc: Use image node_id 2 for calling the Loss obj's underlying member method code with example usage: obj._location_vec(loc) and returns: torch