class_docstr: Implements a Fully-Convolutional Network for semantic segmentation.
  
  Args:
      backbone (nn.Module): the network used to compute the features for the model.
          The backbone should return an OrderedDict[Tensor], with the key being
          "out" for the last feature map used, and "aux" if an auxiliary classifier
          is used.
      classifier (nn.Module): module that takes the "out" element returned from
          the backbone and returns a dense prediction.
      aux_classifier (nn.Module, optional): auxiliary classifier used during training
class_docstr_tok: ["Implements","a","Fully-Convolutional","Network","for","semantic","segmentation",".","Args",":","backbone","(","nn.Module",")",":","the","network","used","to","compute","the","features","for","the","model",".","The","backbone","should","return","an","OrderedDict","[","Tensor","]",",","with","the","key","being","``","out","''","for","the","last","feature","map","used",",","and","``","aux","''","if","an","auxiliary","classifier","is","used",".","classifier","(","nn.Module",")",":","module","that","takes","the","``","out","''","element","returned","from","the","backbone","and","returns","a","dense","prediction",".","aux_classifier","(","nn.Module",",","optional",")",":","auxiliary","classifier","used","during","training"]
code: def forward(self, x: Tensor) -> Dict[str, Tensor]:
      input_shape = x.shape[-2:]
      # contract: features is a dict of tensors
      features = self.backbone(x)
  
      result = OrderedDict()
      x = features["out"]
      x = self.classifier(x)
      # 原论文中虽然使用的是ConvTranspose2d，但权重是冻结的，所以就是一个bilinear插值
      x = F.interpolate(
          x, size=input_shape, mode="bilinear", align_corners=False
      )
      result["out"] = x
  
      if self.aux_classifier is not None:
          x = features["aux"]
          x = self.aux_classifier(x)
          # 原论文中虽然使用的是ConvTranspose2d，但权重是冻结的，所以就是一个bilinear插值
          x = F.interpolate(
              x, size=input_shape, mode="bilinear", align_corners=False
          )
          result["aux"] = x
  
      return result
  
file_path: deep-learning-for-image-processing/pytorch_segmentation/fcn/src/fcn_model.py
imports: from collections import OrderedDict
  from typing import Dict
  import torch
  from torch import nn, Tensor
  from torch.nn import functional
  from .backbone import resnet50, resnet101
label_desc: Use image node_id 2 for calling the FCN obj's underlying member method code with example usage: obj.forward(x) and returns: result