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

Method forward

mmseg/ops/encoding.py:59–70  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

57 return encoded_feat
58
59 def forward(self, x):
60 assert x.dim() == 4 and x.size(1) == self.channels
61 # [batch_size, channels, height, width]
62 batch_size = x.size(0)
63 # [batch_size, height x width, channels]
64 x = x.view(batch_size, self.channels, -1).transpose(1, 2).contiguous()
65 # assignment_weights: [batch_size, channels, num_codes]
66 assignment_weights = F.softmax(
67 self.scaled_l2(x, self.codewords, self.scale), dim=2)
68 # aggregate
69 encoded_feat = self.aggregate(assignment_weights, x, self.codewords)
70 return encoded_feat
71
72 def __repr__(self):
73 repr_str = self.__class__.__name__

Callers

nothing calls this directly

Calls 2

scaled_l2Method · 0.95
aggregateMethod · 0.95

Tested by

no test coverage detected