Initialize weights.
(self)
| 403 | self.teacher = MODELS.build(backbone) |
| 404 | |
| 405 | def init_weights(self) -> None: |
| 406 | """Initialize weights.""" |
| 407 | super().init_weights() |
| 408 | |
| 409 | # init the weights of teacher with those of backbone |
| 410 | for param_backbone, param_teacher in zip(self.backbone.parameters(), |
| 411 | self.teacher.parameters()): |
| 412 | param_teacher.detach() |
| 413 | param_teacher.data.copy_(param_backbone.data) |
| 414 | param_teacher.requires_grad = False |
| 415 | |
| 416 | def momentum_update(self) -> None: |
| 417 | """Momentum update of the teacher network.""" |
no outgoing calls