def __init__(self, dataloader_kNN, num_classes):
    super().__init__(dataloader_kNN, num_classes)
    resnet = lightly.models.ResNetGenerator('resnet-18')
    self.backbone = nn.Sequential(*list(resnet.children())[:(- 1)], nn.AdaptiveAvgPool2d(1))
    self.head = self._build_projection_head()
    self.teacher_backbone = copy.deepcopy(self.backbone)
    self.teacher_head = self._build_projection_head()
    utils.deactivate_requires_grad(self.teacher_backbone)
    utils.deactivate_requires_grad(self.teacher_head)
    self.criterion = lightly.loss.DINOLoss(output_dim=2048)
def __init__(self, dataloader_kNN, num_classes):
    super().__init__(dataloader_kNN, num_classes)
    resnet = lightly.models.ResNetGenerator('resnet-18')
    self.backbone = nn.Sequential(*list(resnet.children())[:(- 1)], nn.AdaptiveAvgPool2d(1))
    self.head = self._build_projection_head()
    self.teacher_backbone = copy.deepcopy(self.backbone)
    self.teacher_head = self._build_projection_head()
    utils.deactivate_requires_grad(self.teacher_backbone)
    utils.deactivate_requires_grad(self.teacher_head)
    self.criterion = lightly.loss.DINOLoss(output_dim=2048)