def init_weights(self, pretrained=None):
        """Initialize the weights in backbone.

        Args:
            pretrained (str, optional): Path to pre-trained weights.
                Defaults to None.
        """
        if pretrained is not None:
            utils.load_pretrained_model(self, self.pretrained)
        else:
            for sublayer in self.sublayers():
                if isinstance(sublayer, nn.Linear):
                    trunc_normal_(sublayer.weight)
                    if isinstance(sublayer,
                                  nn.Linear) and sublayer.bias is not None:
                        zeros_(sublayer.bias)
                elif isinstance(sublayer, nn.LayerNorm):
                    zeros_(sublayer.bias)
                    ones_(sublayer.weight)
Initialize the weights in backbone.

        Args:
            pretrained (str, optional): Path to pre-trained weights.
                Defaults to None.
        
paddleseg/models/backbones/swin_transformer.py