def forward(self, x, centre=None, other=None, penultimate=False): x = self.features(x) x = F.interpolate(x, size=self.input_sz, mode="bilinear") if not penultimate: assert (centre is not None) and (other is not None) patches1, patches2 = get_patches(x, centre, other, self.patch_side) adjacency = self.isola_head(patches1, patches2) x = torch.sigmoid(adjacency) return x
def forward(self, x, centre=None, other=None, penultimate=False): x = self.features(x) x = F.interpolate(x, size=self.input_sz, mode="bilinear") if not penultimate: assert (centre is not None) and (other is not None) patches1, patches2 = get_patches(x, centre, other, self.patch_side) # predicted position distribution, no softmax - using # torch.CrossEntropyLoss # shape: bn, 9 x = self.doersch_head(patches1, patches2) return x