MCPcopy Create free account
hub / github.com/ZHKKKe/MODNet / forward

Method forward

torchscript/modnet_torchscript.py:151–167  ·  view source on GitHub ↗
(self, img, enc2x, enc4x, lr8x)

Source from the content-addressed store, hash-verified

149 )
150
151 def forward(self, img, enc2x, enc4x, lr8x):
152 img2x = F.interpolate(img, scale_factor=1/2, mode='bilinear', align_corners=False)
153 img4x = F.interpolate(img, scale_factor=1/4, mode='bilinear', align_corners=False)
154
155 enc2x = self.tohr_enc2x(enc2x)
156 hr4x = self.conv_enc2x(torch.cat((img2x, enc2x), dim=1))
157
158 enc4x = self.tohr_enc4x(enc4x)
159 hr4x = self.conv_enc4x(torch.cat((hr4x, enc4x), dim=1))
160
161 lr4x = F.interpolate(lr8x, scale_factor=2.0, mode='bilinear', align_corners=False)
162 hr4x = self.conv_hr4x(torch.cat((hr4x, lr4x, img4x), dim=1))
163
164 hr2x = F.interpolate(hr4x, scale_factor=2.0, mode='bilinear', align_corners=False)
165 hr2x = self.conv_hr2x(torch.cat((hr2x, enc2x), dim=1))
166
167 return hr2x
168
169
170class FusionBranch(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected