Hi ptrblck, thank you a lot for your explanation. I just test the method you mentioned, it works great as follows:
class Net(nn.Module):

    def __init__(self):
        super(Net, self).__init__()
        self.conv1 = nn.Conv2d(1, 3, 3)
        self.pool = nn.MaxPool2d(2, 2)

        # now assign the parameters
        K = torch.tensor([[0.,0.,0.],[1.,1.,1.],[2.,2.,2.]])
        K = torch.unsqueeze(torch.unsqueeze(K,0),0)
        
        with torch.no_grad():
            self.conv1.weight = nn.Parameter(K)
    
    def forward(self, x):
        x = self.pool(F.relu(self.conv1(x)))
        return x

net = Net()


However, I am quite confused with torch.no_grad() here. As it is mentioned in the document, with torch.no_grad() could set the require gradient into False and stop the gradient calculation. Nevertheless, when I print out the parameters, all of them are still trainable. May I ask why this happen?
for param in net.parameters():
    print(param)

Parameter containing:
tensor([[[[0., 0., 0.],
          [1., 1., 1.],
          [2., 2., 2.]]]], requires_grad=True)
Parameter containing:
tensor([ 0.0328, -0.2026, -0.2669], requires_grad=True)