(self, n_dim, K=65536, T=0.07)
| 91 | class CMCMoCo(BaseMoCo): |
| 92 | """MoCo-style memory for two modalities, e.g. in CMC""" |
| 93 | def __init__(self, n_dim, K=65536, T=0.07): |
| 94 | super(CMCMoCo, self).__init__(K, T) |
| 95 | # create memory queue |
| 96 | self.register_buffer('memory_1', torch.randn(K, n_dim)) |
| 97 | self.register_buffer('memory_2', torch.randn(K, n_dim)) |
| 98 | self.memory_1 = F.normalize(self.memory_1) |
| 99 | self.memory_2 = F.normalize(self.memory_2) |
| 100 | |
| 101 | def forward(self, q1, k1, q2, k2, |
| 102 | q1_jig=None, q2_jig=None, |