(self, batch_I)
| 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 | |
| 42 | class LocalizationNetwork(nn.Module): |
nothing calls this directly
no test coverage detected