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.projection_head = heads.BYOLProjectionHead(512, 1024, 256)
    self.prediction_head = heads.BYOLProjectionHead(256, 1024, 256)
    self.backbone_momentum = copy.deepcopy(self.backbone)
    self.projection_head_momentum = copy.deepcopy(self.projection_head)
    utils.deactivate_requires_grad(self.backbone_momentum)
    utils.deactivate_requires_grad(self.projection_head_momentum)
    self.criterion = lightly.loss.NegativeCosineSimilarity()
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.projection_head = heads.BYOLProjectionHead(512, 1024, 256)
    self.prediction_head = heads.BYOLProjectionHead(256, 1024, 256)
    self.backbone_momentum = copy.deepcopy(self.backbone)
    self.projection_head_momentum = copy.deepcopy(self.projection_head)
    utils.deactivate_requires_grad(self.backbone_momentum)
    utils.deactivate_requires_grad(self.projection_head_momentum)
    self.criterion = lightly.loss.NegativeCosineSimilarity()