MCPcopy Create free account
hub / github.com/buaacxf/VIPTR / forward

Method forward

modules/transformation.py:29–39  ·  view source on GitHub ↗
(self, batch_I)

Source from the content-addressed store, hash-verified

27 self.GridGenerator = GridGenerator(self.F, self.I_r_size)
28
29 def forward(self, batch_I):
30 batch_C_prime = self.LocalizationNetwork(batch_I) # batch_size x K x 2
31 build_P_prime = self.GridGenerator.build_P_prime(batch_C_prime) # batch_size x n (= I_r_width x I_r_height) x 2
32 build_P_prime_reshape = build_P_prime.reshape([build_P_prime.size(0), self.I_r_size[0], self.I_r_size[1], 2])
33
34 if torch.__version__ > "1.2.0":
35 batch_I_r = F.grid_sample(batch_I, build_P_prime_reshape, padding_mode='border', align_corners=True)
36 else:
37 batch_I_r = F.grid_sample(batch_I, build_P_prime_reshape, padding_mode='border')
38
39 return batch_I_r
40
41
42class LocalizationNetwork(nn.Module):

Callers

nothing calls this directly

Calls 1

build_P_primeMethod · 0.80

Tested by

no test coverage detected