(self, x)
| 32 | self.k = k |
| 33 | |
| 34 | def forward(self, x): |
| 35 | bsz = x.shape[0] |
| 36 | x = self.fc1(x) |
| 37 | # ==== shuffle ==== |
| 38 | # this step can be moved to data processing step |
| 39 | shuffle_ids = self.get_shuffle_ids(bsz) |
| 40 | x = x[shuffle_ids] |
| 41 | # ==== shuffle ==== |
| 42 | n_img = int(bsz / self.k) |
| 43 | x = x.view(n_img, -1) |
| 44 | x = self.fc2(x) |
| 45 | x = self.l2norm(x) |
| 46 | return x |
| 47 | |
| 48 | def get_shuffle_ids(self, bsz): |
| 49 | n_img = int(bsz / self.k) |
nothing calls this directly
no test coverage detected