MCPcopy Create free account
hub / github.com/VCIP-RGBD/DFormer / forward

Method forward

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

Source from the content-addressed store, hash-verified

49 return encoded_feat
50
51 def forward(self, x):
52 assert x.dim() == 4 and x.size(1) == self.channels
53 # [batch_size, channels, height, width]
54 batch_size = x.size(0)
55 # [batch_size, height x width, channels]
56 x = x.view(batch_size, self.channels, -1).transpose(1, 2).contiguous()
57 # assignment_weights: [batch_size, channels, num_codes]
58 assignment_weights = F.softmax(self.scaled_l2(x, self.codewords, self.scale), dim=2)
59 # aggregate
60 encoded_feat = self.aggregate(assignment_weights, x, self.codewords)
61 return encoded_feat
62
63 def __repr__(self):
64 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