code: def get_sample_region(
      self,
      boxes,
      strides,
      num_loc_list,
      loc_xs,
      loc_ys,
      bitmasks=None,
      radius=1,
  ):
      if bitmasks is not None:
          _, h, w = bitmasks.size()
  
          ys = torch.arange(
              0, h, dtype=torch.float32, device=bitmasks.device
          )
          xs = torch.arange(
              0, w, dtype=torch.float32, device=bitmasks.device
          )
  
          m00 = bitmasks.sum(dim=-1).sum(dim=-1).clamp(min=1e-6)
          m10 = (bitmasks * xs).sum(dim=-1).sum(dim=-1)
          m01 = (bitmasks * ys[:, None]).sum(dim=-1).sum(dim=-1)
          center_x = m10 / m00
          center_y = m01 / m00
      else:
          center_x = boxes[..., [0, 2]].sum(dim=-1) * 0.5
          center_y = boxes[..., [1, 3]].sum(dim=-1) * 0.5
  
      num_gts = boxes.shape[0]
      K = len(loc_xs)
      boxes = boxes[None].expand(K, num_gts, 4)
      center_x = center_x[None].expand(K, num_gts)
      center_y = center_y[None].expand(K, num_gts)
      center_gt = boxes.new_zeros(boxes.shape)
      # no gt
      if center_x.numel() == 0 or center_x[..., 0].sum() == 0:
          return loc_xs.new_zeros(loc_xs.shape, dtype=torch.uint8)
      beg = 0
      for level, num_loc in enumerate(num_loc_list):
          end = beg + num_loc
          stride = strides[level] * radius
          xmin = center_x[beg:end] - stride
          ymin = center_y[beg:end] - stride
          xmax = center_x[beg:end] + stride
          ymax = center_y[beg:end] + stride
          # limit sample region in gt
          center_gt[beg:end, :, 0] = torch.where(
              xmin > boxes[beg:end, :, 0], xmin, boxes[beg:end, :, 0]
          )
          center_gt[beg:end, :, 1] = torch.where(
              ymin > boxes[beg:end, :, 1], ymin, boxes[beg:end, :, 1]
          )
          center_gt[beg:end, :, 2] = torch.where(
              xmax > boxes[beg:end, :, 2], boxes[beg:end, :, 2], xmax
          )
          center_gt[beg:end, :, 3] = torch.where(
              ymax > boxes[beg:end, :, 3], boxes[beg:end, :, 3], ymax
          )
          beg = end
      left = loc_xs[:, None] - center_gt[..., 0]
      right = center_gt[..., 2] - loc_xs[:, None]
      top = loc_ys[:, None] - center_gt[..., 1]
      bottom = center_gt[..., 3] - loc_ys[:, None]
      center_bbox = torch.stack((left, top, right, bottom), -1)
      inside_gt_bbox_mask = center_bbox.min(-1)[0] > 0
      return inside_gt_bbox_mask
  
imports: import logging
  import math
  from typing import List, Dict
  import torch
  from torch import nn
  from torch.nn import functional
  from ...nn.shape_spec import ShapeSpec
  from ...nn.deform_conv import DeformConvWithChangeableStride
  from ...nn.group_norm import NaiveGroupNorm
  from ...data.structures import Instances, Boxes
  from ...nn.focal_loss import sigmoid_focal_loss_jit
  from ...nn.nms import ml_nms
  from ...utils.loss import IOULoss
  from ...utils.comm import get_world_size, reduce_sum, compute_locations
label_desc: Use image node_id 4 for calling the FCOSOutputs obj's underlying member method code with example usage: obj.get_sample_region(boxes, strides, num_loc_list, loc_xs, loc_ys, bitmasks, radius) and returns: inside_gt_bbox_mask, loc_xs