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

Class Laplacian

src/sobel.py:26–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25
26class Laplacian(nn.Module):
27 def __init__(self):
28 super().__init__()
29 self.filter = nn.Conv2d(in_channels=3, out_channels=3, kernel_size=3, stride=1, padding=1, bias=False, groups=3)
30 G = torch.tensor([[-1, -1, -1], [-1, 8, -1], [-1, -1, -1]]).float()
31 G = G.unsqueeze(0).unsqueeze(0)
32 G = torch.cat([G, G, G], 0)
33 self.filter.weight = nn.Parameter(G, requires_grad=False)
34
35 def forward(self, img):
36 x = self.filter(img)
37 return x
38
39if __name__ == "__main__":
40 laplacian = Laplacian()

Callers 2

__init__Method · 0.90
sobel.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected