#初始化kernel_weight
import torch
input = [3,4,6,5,7,
         2,4,6,8,2,
         1,6,7,8,4,
         9,7,4,6,2,
         3,7,5,4,1,]

input=torch.Tensor(input).view(1,1,5,5)#B*C*W*H
conv_layer = torch.nn.Conv2d(1,1,kernel_size=3,padding=1,bias=False)#输入C，输出C，kernel
kernel = torch.Tensor([1,2,3,4,5,6,7,8,9]).view(1,1,3,3)#输出C，输入C*W*H
conv_layer.weight.data = kernel.data
output=conv_layer(input)
print(output)