import torch
import torch.nn as nn
class Laplace(nn.Module):
def __init__(self):
super(Laplace,self).__init__()
self.conv1=nn.Conv2d(in_channels=3,out_channels=1,kernel_size=3,stride=1,padding=0,bias=False)
nn.init.constant_(self.conv1.weight,1)
nn.init.constant_(self.conv1.weight[0,0,1,1],-8)
nn.init.constant_(self.conv1.weight[0,1,1,1],-8)
nn.init.constant_(self.conv1.weight[0,2,1,1],-8)
def forward(self,x1):
edge_map=self.conv1(x1)
return edge_map
09-11
7734
05-22
9269