class_docstr: SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers
code: def forward(self, feature_maps: List[Tensor], output_size):
      c1, c2, c3, c4 = feature_maps
  
      c4 = self.linear_c4(c4)
      c3 = self.linear_c3(c3)
      c2 = self.linear_c2(c2)
      c1 = self.linear_c1(c1)
  
      c = self.linear_fuse(
          torch.cat(
              [
                  torch.nn.functional.interpolate(
                      c4,
                      size=c1.size()[2:],
                      mode="bilinear",
                      align_corners=False,
                  ),
                  torch.nn.functional.interpolate(
                      c3,
                      size=c1.size()[2:],
                      mode="bilinear",
                      align_corners=False,
                  ),
                  torch.nn.functional.interpolate(
                      c2,
                      size=c1.size()[2:],
                      mode="bilinear",
                      align_corners=False,
                  ),
                  c1,
              ],
              dim=1,
          )
      )
  
      x = self.dropout(c)
      x = self.final(x)
      x = torch.nn.functional.interpolate(
          x, size=output_size, mode="bilinear", align_corners=False
      )
  
      if self.output_name is not None:
          outputs = {self.output_name: x}
      else:
          outputs = x
  
      if self.with_supervision:
          s4, s3, s2, s1 = (
              self.supervision_c4(c4),
              self.supervision_c3(c3),
              self.supervision_c2(c2),
              self.supervision_c1(c1),
          )
  
          if self.output_name is not None:
              outputs[name_for_stride(self.output_name, 32)] = s4
              outputs[name_for_stride(self.output_name, 16)] = s3
              outputs[name_for_stride(self.output_name, 8)] = s2
              outputs[name_for_stride(self.output_name, 4)] = s1
          else:
              outputs = outputs + (s1, s2, s3, s4)
  
      return outputs
  
file_path: pytorch-toolbelt/pytorch_toolbelt/modules/heads/segformer_head.py
imports: from typing import List, Optional
  import torch
  import torch.nn
  from torch import Tensor
  from pytorch_toolbelt.datasets import name_for_stride
  from pytorch_toolbelt.modules import instantiate_activation_block, ACT_GELU
  from pytorch_toolbelt.modules.interfaces import AbstractHead, FeatureMapsSpecification
label_desc: Use image node_id 2 for calling the SegFormerHead obj's underlying member method code with example usage: obj.forward(feature_maps, output_size) and returns: outputs