src/transformers/models/deta/modeling_deta.py/DetaBackboneWithPositionalEncodings/__init__
class DetaBackboneWithPositionalEncodings:    def __init__(self, config):
        super().__init__()

        backbone = AutoBackbone.from_config(config.backbone_config)
        with torch.no_grad():
            replace_batch_norm(backbone)
        self.model = backbone
        self.intermediate_channel_sizes = self.model.channels

        # TODO fix this
        if config.backbone_config.model_type == "resnet":
            for name, parameter in self.model.named_parameters():
                if "stages.1" not in name and "stages.2" not in name and "stages.3" not in name:
                    parameter.requires_grad_(False)

        self.position_embedding = build_position_encoding(config)