MCPcopy Create free account
hub / github.com/drinkingcoder/NeuralMarker / corr

Method corr

core/corr.py:53–61  ·  view source on GitHub ↗
(fmap1, fmap2)

Source from the content-addressed store, hash-verified

51
52 @staticmethod
53 def corr(fmap1, fmap2):
54 batch, dim, ht, wd = fmap1.shape
55 batch, dim, ht2, wd2 = fmap2.shape
56 fmap1 = fmap1.view(batch, dim, ht*wd)
57 fmap2 = fmap2.view(batch, dim, ht2*wd2)
58
59 corr = torch.matmul(fmap1.transpose(1,2), fmap2)
60 corr = corr.view(batch, ht, wd, 1, ht2, wd2)
61 return corr / torch.sqrt(torch.tensor(dim).float())
62
63
64class AlternateCorrBlock:

Callers 1

__init__Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected