MCPcopy
hub / github.com/xingyizhou/CenterNet / _gather_feat

Function _gather_feat

src/lib/models/utils.py:12–20  ·  view source on GitHub ↗
(feat, ind, mask=None)

Source from the content-addressed store, hash-verified

10 return y
11
12def _gather_feat(feat, ind, mask=None):
13 dim = feat.size(2)
14 ind = ind.unsqueeze(2).expand(ind.size(0), ind.size(1), dim)
15 feat = feat.gather(1, ind)
16 if mask is not None:
17 mask = mask.unsqueeze(2).expand_as(feat)
18 feat = feat[mask]
19 feat = feat.view(-1, dim)
20 return feat
21
22def _transpose_and_gather_feat(feat, ind):
23 feat = feat.permute(0, 2, 3, 1).contiguous()

Callers 4

_topkFunction · 0.85
agnex_ct_decodeFunction · 0.85
exct_decodeFunction · 0.85

Calls 1

gatherMethod · 0.80

Tested by

no test coverage detected