MCPcopy Create free account
hub / github.com/Royalvice/DocDiff / forward

Method forward

src/sobel.py:16–23  ·  view source on GitHub ↗
(self, img)

Source from the content-addressed store, hash-verified

14 self.filter.weight = nn.Parameter(G, requires_grad=False)
15
16 def forward(self, img):
17 if img.shape[1] == 3:
18 img = torch.mean(img, dim=1, keepdim=True)
19 x = self.filter(img)
20 x = torch.mul(x, x)
21 x = torch.sum(x, dim=1, keepdim=True)
22 x = torch.sqrt(x)
23 return x
24
25
26class Laplacian(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected