code: def fpn_model(features):
      """
      Args:
          features ([tf.Tensor]): ResNet features c2-c5
  
      Returns:
          [tf.Tensor]: FPN features p2-p6
      """
      assert len(features) == 4, features
      num_channel = cfg.FPN.NUM_CHANNEL
  
      use_gn = cfg.FPN.NORM == "GN"
  
      def upsample2x(name, x):
          try:
              resize = tf.compat.v2.image.resize_images
              with tf.name_scope(name):
                  shp2d = tf.shape(x)[2:]
                  x = tf.transpose(x, [0, 2, 3, 1])
                  x = resize(x, shp2d * 2, "nearest")
                  x = tf.transpose(x, [0, 3, 1, 2])
                  return x
          except AttributeError:
              return FixedUnPooling(
                  name,
                  x,
                  2,
                  unpool_mat=np.ones((2, 2), dtype="float32"),
                  data_format="channels_first",
              )
  
      with argscope(
          Conv2D,
          data_format="channels_first",
          activation=tf.identity,
          use_bias=True,
          kernel_initializer=tfv1.variance_scaling_initializer(
              scale=1.0
          ),
      ):
          lat_2345 = [
              Conv2D("lateral_1x1_c{}".format(i + 2), c, num_channel, 1)
              for i, c in enumerate(features)
          ]
          if use_gn:
              lat_2345 = [
                  GroupNorm("gn_c{}".format(i + 2), c)
                  for i, c in enumerate(lat_2345)
              ]
          lat_sum_5432 = []
          for idx, lat in enumerate(lat_2345[::-1]):
              if idx == 0:
                  lat_sum_5432.append(lat)
              else:
                  lat = lat + upsample2x(
                      "upsample_lat{}".format(6 - idx), lat_sum_5432[-1]
                  )
                  lat_sum_5432.append(lat)
          p2345 = [
              Conv2D("posthoc_3x3_p{}".format(i + 2), c, num_channel, 3)
              for i, c in enumerate(lat_sum_5432[::-1])
          ]
          if use_gn:
              p2345 = [
                  GroupNorm("gn_p{}".format(i + 2), c)
                  for i, c in enumerate(p2345)
              ]
          p6 = MaxPooling(
              "maxpool_p6",
              p2345[-1],
              pool_size=1,
              strides=2,
              data_format="channels_first",
              padding="VALID",
          )
          return p2345 + [p6]
  
imports: import itertools
  import numpy
  import tensorflow
  from tensorpack import tfv1
  from tensorpack.models import Conv2D, FixedUnPooling, MaxPooling, layer_register
  from tensorpack.tfutils.argscope import argscope
  from tensorpack.tfutils.scope_utils import under_name_scope
  from tensorpack.tfutils.summary import add_moving_summary
  from tensorpack.tfutils.tower import get_current_tower_context
  from tensorpack.utils.argtools import memoized
  from config import config
  from utils.box_ops import area
  from .backbone import GroupNorm
  from .model_box import roi_align
  from .model_rpn import generate_rpn_proposals, rpn_losses, get_all_anchors
label_desc: Use image node_id 1 for calling a global function with example usage: fpn_model(features) and returns: unknown, x, FixedUnPooling