MCPcopy Create free account
hub / github.com/HobbitLong/PyContrast / forward

Method forward

pycontrast/networks/util.py:34–46  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

32 self.k = k
33
34 def forward(self, x):
35 bsz = x.shape[0]
36 x = self.fc1(x)
37 # ==== shuffle ====
38 # this step can be moved to data processing step
39 shuffle_ids = self.get_shuffle_ids(bsz)
40 x = x[shuffle_ids]
41 # ==== shuffle ====
42 n_img = int(bsz / self.k)
43 x = x.view(n_img, -1)
44 x = self.fc2(x)
45 x = self.l2norm(x)
46 return x
47
48 def get_shuffle_ids(self, bsz):
49 n_img = int(bsz / self.k)

Callers

nothing calls this directly

Calls 1

get_shuffle_idsMethod · 0.95

Tested by

no test coverage detected