src/transformers/models/convnextv2/modeling_convnextv2.py/ConvNextV2Backbone/__init__
class ConvNextV2Backbone:    def __init__(self, config):
        super().__init__(config)

        self.stage_names = config.stage_names
        self.embeddings = ConvNextV2Embeddings(config)
        self.encoder = ConvNextV2Encoder(config)

        self.out_features = config.out_features if config.out_features is not None else [self.stage_names[-1]]

        out_feature_channels = {}
        out_feature_channels["stem"] = config.hidden_sizes[0]
        for idx, stage in enumerate(self.stage_names[1:]):
            out_feature_channels[stage] = config.hidden_sizes[idx]

        self.out_feature_channels = out_feature_channels

        # Add layer norms to hidden states of out_features
        hidden_states_norms = {}
        for stage, num_channels in zip(self.out_features, self.channels):
            hidden_states_norms[stage] = ConvNextV2LayerNorm(num_channels, data_format="channels_first")
        self.hidden_states_norms = nn.ModuleDict(hidden_states_norms)

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