MCPcopy Create free account
hub / github.com/devinxzhang/MFuser / __init__

Method __init__

mmseg/models/utils/encoding.py:18–31  ·  view source on GitHub ↗
(self, channels, num_codes)

Source from the content-addressed store, hash-verified

16 """
17
18 def __init__(self, channels, num_codes):
19 super().__init__()
20 # init codewords and smoothing factor
21 self.channels, self.num_codes = channels, num_codes
22 std = 1. / ((num_codes * channels)**0.5)
23 # [num_codes, channels]
24 self.codewords = nn.Parameter(
25 torch.empty(num_codes, channels,
26 dtype=torch.float).uniform_(-std, std),
27 requires_grad=True)
28 # [num_codes]
29 self.scale = nn.Parameter(
30 torch.empty(num_codes, dtype=torch.float).uniform_(-1, 0),
31 requires_grad=True)
32
33 @staticmethod
34 def scaled_l2(x, codewords, scale):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected