class_docstr: Implement FCOS (https://arxiv.org/abs/1904.01355).
class_docstr_tok: ["Implement","FCOS","(","https",":","\/\/arxiv.org\/abs\/1904.01355",")","."]
code: def compute_locations(self, features):
      locations = []
      for level, feature in enumerate(features):
          h, w = feature.size()[-2:]
          locations_per_level = compute_locations(
              h, w, self.fpn_strides[level], feature.device
          )
          locations.append(locations_per_level)
      return locations
  
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 FCOS obj's underlying member method code with example usage: obj.compute_locations(features) and returns: locations