src/transformers/models/maskformer/modeling_maskformer_swin.py/MaskFormerSwinBackbone/__init__
class MaskFormerSwinBackbone:    def __init__(self, config: MaskFormerSwinConfig):
        super().__init__(config)

        self.stage_names = config.stage_names
        self.model = MaskFormerSwinModel(config)

        self.out_features = config.out_features if config.out_features is not None else [self.stage_names[-1]]
        if "stem" in self.out_features:
            raise ValueError("This backbone does not support 'stem' in the `out_features`.")

        num_features = [int(config.embed_dim * 2**i) for i in range(len(config.depths))]
        self.out_feature_channels = {}
        for i, stage in enumerate(self.stage_names[1:]):
            self.out_feature_channels[stage] = num_features[i]

        self.hidden_states_norms = nn.ModuleList([nn.LayerNorm(num_channels) for num_channels in self.channels])

        # Initialize weights and apply final processing
        self.post_init()