class_docstr: Implement FCOS in :paper:`fcos`.
class_docstr_tok: ["Implement","FCOS","in",":","paper",":","`","fcos","`","."]
code: def compute_ctrness_targets(
      self, anchors: List[Boxes], gt_boxes: List[torch.Tensor]
  ):
      anchors = Boxes.cat(anchors).tensor  # Rx4
      reg_targets = [
          self.box2box_transform.get_deltas(anchors, m)
          for m in gt_boxes
      ]
      reg_targets = torch.stack(reg_targets, dim=0)  # NxRx4
      if len(reg_targets) == 0:
          return reg_targets.new_zeros(len(reg_targets))
      left_right = reg_targets[:, :, [0, 2]]
      top_bottom = reg_targets[:, :, [1, 3]]
      ctrness = (
          left_right.min(dim=-1)[0] / left_right.max(dim=-1)[0]
      ) * (top_bottom.min(dim=-1)[0] / top_bottom.max(dim=-1)[0])
      return torch.sqrt(ctrness)
  
imports: import logging
  from typing import List, Optional, Tuple
  import torch
  from fvcore.nn import sigmoid_focal_loss_jit
  from torch import nn
  from torch.nn import functional
  from detectron2.layers import ShapeSpec, batched_nms
  from detectron2.structures import Boxes, ImageList, Instances, pairwise_point_box_distance
  from detectron2.utils.events import get_event_storage
  from ..anchor_generator import DefaultAnchorGenerator
  from ..backbone import Backbone
  from ..box_regression import Box2BoxTransformLinear, _dense_box_regression_loss
  from .dense_detector import DenseDetector
  from .retinanet import RetinaNetHead
label_desc: Use image node_id 6 for calling the FCOS obj's underlying member method code with example usage: obj.compute_ctrness_targets(anchors, gt_boxes) and returns: torch, reg_targets