def METHOD_NAME(
    self,
    imgs: Optional[torch.Tensor],
    masks: Optional[torch.Tensor] = None,
    **kwargs,
) -> Dict[Any, torch.Tensor]:
    """
    Args:
        imgs: A batch of input images of shape `(B, 3, H, W)`.
        masks: A batch of input masks of shape `(B, 3, H, W)`.
    Returns:
        out_feats: A dict `{f_i: t_i}` keyed by predicted feature names `f_i`
            and their corresponding tensors `t_i` of shape `(B, dim_i, H_i, W_i)`.
    """
    out_feats = {}
    imgs_input = imgs
    if self.image_rescale != 1.0 and imgs_input is not None:
        imgs_resized = Fu.interpolate(
            imgs_input,
            scale_factor=self.image_rescale,
            mode="bilinear",
        )
    else:
        imgs_resized = imgs_input
    if len(self.stages) > 0:
        assert imgs_resized is not None
        if self.normalize_image:
            imgs_normed = self._resnet_normalize_image(imgs_resized)
        else:
            imgs_normed = imgs_resized
        #  is not a function.
        feats = self.stem(imgs_normed)
        for stage, (layer, proj) in enumerate(zip(self.layers, self.proj_layers)):
            feats = layer(feats)
            # just a sanity check below
            assert feats.shape[1] == _FEAT_DIMS[self.name][stage]
            if (stage + 1) in self.stages:
                f = proj(feats)
                if self.global_average_pool:
                    f = f.mean(dims=(2, 3))
                if self.l2_norm:
                    normfac = 1.0 / math.sqrt(len(self.stages))
                    f = Fu.normalize(f, dim=1) * normfac
                feature_name = self._get_resnet_stage_feature_name(stage)
                out_feats[feature_name] = f
    if self.add_masks:
        assert masks is not None
        out_feats[MASK_FEATURE_NAME] = masks
    if self.add_images:
        assert imgs_resized is not None
        out_feats[IMAGE_FEATURE_NAME] = imgs_resized
    if self.feature_rescale != 1.0:
        out_feats = {k: self.feature_rescale * f for k, f in out_feats.items()}
    # pyre-fixme[7]: Incompatible return type, expected `Dict[typing.Any, Tensor]`
    # but got `Dict[typing.Any, float]`
    return out_feats