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

Method forward

models/decoders/LMLPDecoder.py:61–80  ·  view source on GitHub ↗
(self, inputs)

Source from the content-addressed store, hash-verified

59 self.linear_pred = nn.Conv2d(embedding_dim, self.num_classes, kernel_size=1)
60
61 def forward(self, inputs):
62 # len=4, 1/4,1/8,1/16,1/32
63 c2, c3, c4 = inputs[1:]
64
65 ############## MLP decoder on C1-C4 ###########
66 n, _, h, w = c4.shape
67
68 _c4 = self.linear_c4(c4).permute(0, 2, 1).reshape(n, -1, c4.shape[2], c4.shape[3])
69 _c4 = F.interpolate(_c4, size=c2.size()[2:], mode="bilinear", align_corners=self.align_corners)
70
71 _c3 = self.linear_c3(c3).permute(0, 2, 1).reshape(n, -1, c3.shape[2], c3.shape[3])
72 _c3 = F.interpolate(_c3, size=c2.size()[2:], mode="bilinear", align_corners=self.align_corners)
73
74 _c2 = self.linear_c2(c2).permute(0, 2, 1).reshape(n, -1, c2.shape[2], c2.shape[3])
75
76 _c = self.linear_fuse(torch.cat([_c4, _c3, _c2], dim=1))
77 x = self.dropout(_c)
78 x = self.linear_pred(x)
79
80 return x

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected