class_docstr: Module that adds a FPN from on top of a set of feature maps. This is based on
  `"Feature Pyramid Network for Object Detection" <https://arxiv.org/abs/1612.03144>`_.
  
  The feature maps are currently supposed to be in increasing depth
  order.
  
  The input to the model is expected to be an OrderedDict[Tensor], containing
  the feature maps on top of which the FPN will be added.
  
  Args:
      spatial_dims: 2D or 3D images
      in_channels_list: number of channels for each feature map that
          is passed to the module
      out_channels: number of channels of the FPN representation
      extra_blocks: if provided, extra operations will
          be performed. It is expected to take the fpn features, the original
          features and the names of the original features as input, and returns
          a new list of feature maps and their corresponding names
  
  Examples::
  
      >>> m = FeaturePyramidNetwork(2, [10, 20, 30], 5)
      >>> # get some dummy data
      >>> x = OrderedDict()
      >>> x['feat0'] = torch.rand(1, 10, 64, 64)
      >>> x['feat2'] = torch.rand(1, 20, 16, 16)
      >>> x['feat3'] = torch.rand(1, 30, 8, 8)
      >>> # compute the FPN on top of x
      >>> output = m(x)
      >>> print([(k, v.shape) for k, v in output.items()])
      >>> # returns
      >>>   [('feat0', torch.Size([1, 5, 64, 64])),
      >>>    ('feat2', torch.Size([1, 5, 16, 16])),
      >>>    ('feat3', torch.Size([1, 5, 8, 8]))]
docstr: Computes the FPN for a set of feature maps.
  
  Args:
      x: feature maps for each feature level.
  
  Returns:
      feature maps after FPN layers. They are ordered from highest resolution first.
docstr_tok: ["Computes","the","FPN","for","a","set","of","feature","maps",".","Args",":","x",":","feature","maps","for","each","feature","level",".","Returns",":","feature","maps","after","FPN","layers",".","They","are","ordered","from","highest","resolution","first","."]
code: def forward(self, x: dict[str, Tensor]) -> dict[str, Tensor]:
      """
      Computes the FPN for a set of feature maps.
  
      Args:
          x: feature maps for each feature level.
  
      Returns:
          feature maps after FPN layers. They are ordered from highest resolution first.
      """
      # unpack OrderedDict into two lists for easier handling
      names = list(x.keys())
      x_values: list[Tensor] = list(x.values())
  
      last_inner = self.get_result_from_inner_blocks(x_values[-1], -1)
      results = []
      results.append(self.get_result_from_layer_blocks(last_inner, -1))
  
      for idx in range(len(x_values) - 2, -1, -1):
          inner_lateral = self.get_result_from_inner_blocks(
              x_values[idx], idx
          )
          feat_shape = inner_lateral.shape[2:]
          inner_top_down = F.interpolate(
              last_inner, size=feat_shape, mode="nearest"
          )
          last_inner = inner_lateral + inner_top_down
          results.insert(
              0, self.get_result_from_layer_blocks(last_inner, idx)
          )
  
      if self.extra_blocks is not None:
          results, names = self.extra_blocks(results, x_values, names)
  
      # make it back an OrderedDict
      out = OrderedDict(list(zip(names, results)))
  
      return out
  
imports: from __future__ import annotations
  from collections import OrderedDict
  from collections.abc import Callable
  import torch.nn.functional
  from torch import Tensor, nn
  from monai.networks.layers.factories import Conv, Pool
label_desc: Use image node_id 4 for calling the FeaturePyramidNetwork obj's underlying member method code with example usage: obj.forward(x) and returns: out