| 31 | return po |
| 32 | |
| 33 | class Corr(Function): |
| 34 | @staticmethod |
| 35 | def symbolic(g, x, kernel, groups): |
| 36 | return g.op("Corr", x, kernel, groups_i=groups) |
| 37 | |
| 38 | @staticmethod |
| 39 | def forward(self, x, kernel, groups, kwargs): |
| 40 | """group conv2d to calculate cross correlation |
| 41 | """ |
| 42 | batch = x.size(0) |
| 43 | channel = x.size(1) |
| 44 | x = x.view(1, -1, x.size(2), x.size(3)) |
| 45 | kernel = kernel.view(-1, channel // groups, kernel.size(2), kernel.size(3)) |
| 46 | out = F.conv2d(x, kernel, **kwargs, groups=groups * batch) |
| 47 | out = out.view(batch, -1, out.size(2), out.size(3)) |
| 48 | return out |
| 49 | |
| 50 | class Correlation(nn.Module): |
| 51 | use_slow = True |
nothing calls this directly
no outgoing calls
no test coverage detected