(self, x)
return tuple(results)
Arguments:
            x (list[Tensor]): feature maps for each feature level.
        Returns:
            results (tuple[Tensor]): feature maps after FPN layers.
                They are ordered from highest resolution first.
Arguments:
            x (list[Tensor]): feature maps for each feature level.
        Returns:
            results (tuple[Tensor]): feature maps after FPN layers.
                They are ordered from highest resolution first.
Arguments : x ( list [ Tensor ] ) : feature maps for each feature level . Returns : results ( tuple [ Tensor ] ) : feature maps after FPN layers . They are ordered from highest resolution first .
def forward(self, x):
        """
        Arguments:
            x (list[Tensor]): feature maps for each feature level.
        Returns:
            results (tuple[Tensor]): feature maps after FPN layers.
                They are ordered from highest resolution first.
        """
        last_inner = getattr(self, self.inner_blocks[-1])(x[-1])
        results = []
        results.append(getattr(self, self.layer_blocks[-1])(last_inner))
        for feature, inner_block, layer_block in zip(
            x[:-1][::-1], self.inner_blocks[:-1][::-1], self.layer_blocks[:-1][::-1]
        ):
            if not inner_block:
                continue
            inner_top_down = F.interpolate(last_inner, scale_factor=2, mode="nearest")
            inner_lateral = getattr(self, inner_block)(feature)
            # TODO use size instead of scale to make it robust to different sizes
            # inner_top_down = F.upsample(last_inner, size=inner_lateral.shape[-2:],
            # mode='bilinear', align_corners=False)
            last_inner = inner_lateral + inner_top_down
            results.insert(0, getattr(self, layer_block)(last_inner))

        if isinstance(self.top_blocks, LastLevelP6P7):
            last_results = self.top_blocks(x[-1], results[-1])
            results.extend(last_results)
        elif isinstance(self.top_blocks, LastLevelMaxPool):
            last_results = self.top_blocks(results[-1])
            results.extend(last_results)

        return tuple(results)
def forward ( self , x ) : last_inner = getattr ( self , self . inner_blocks [ - 1 ] ) ( x [ - 1 ] ) results = [ ] results . append ( getattr ( self , self . layer_blocks [ - 1 ] ) ( last_inner ) ) for feature , inner_block , layer_block in zip ( x [ : - 1 ] [ : : - 1 ] , self . inner_blocks [ : - 1 ] [ : : - 1 ] , self . layer_blocks [ : - 1 ] [ : : - 1 ] ) : if not inner_block : continue inner_top_down = F . interpolate ( last_inner , scale_factor = 2 , mode = "nearest" ) inner_lateral = getattr ( self , inner_block ) ( feature ) # TODO use size instead of scale to make it robust to different sizes # inner_top_down = F.upsample(last_inner, size=inner_lateral.shape[-2:], # mode='bilinear', align_corners=False) last_inner = inner_lateral + inner_top_down results . insert ( 0 , getattr ( self , layer_block ) ( last_inner ) ) if isinstance ( self . top_blocks , LastLevelP6P7 ) : last_results = self . top_blocks ( x [ - 1 ] , results [ - 1 ] ) results . extend ( last_results ) elif isinstance ( self . top_blocks , LastLevelMaxPool ) : last_results = self . top_blocks ( results [ - 1 ] ) results . extend ( last_results ) return tuple ( results )