Thak you
If I create another variable as you said, It worked well.
Can I ask one more thing?
I tried to apply this method ( To create variable) to other line which is
quantize_weight = torch.round(tempVar * 4) / 4

but It doesn’t work…
class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.w = nn.Parameter(torch.randn(1,1,2,2))
        self.myParam = nn.Parameter(torch.rand(1))

    def myfun(self,w):
        tempVar = torch.where(self.w > 0, (self.w * self.myParam), self.w) # this line worked very well!!!
        # I added this line
        quantize_weight = torch.round(tempVar * 4) / 4
        print(quantize_weight)
        return quantize_weight

    def  forward(self,x):
        q_w = self.myfun(self.w)
        return F.conv2d(input,q_w)

net = Net()

print("before ---------------------")
for name,param in net.named_parameters():
    print(name," ",param.data)

input = torch.randn(1,1,3,3)
target = torch.ones(1,1,2,2)
loss_fn = torch.nn.MSELoss(reduction='sum')
optimizer = torch.optim.Adam(net.parameters())

output = net(input)


loss = loss_fn(output,target)
optimizer.zero_grad()    
loss.backward()
optimizer.step()

print("after ---------------------")
for name,param in net.named_parameters():
    print(name," ",param.data)

result of when I added the line.
before ---------------------
w   tensor([[[[1.1107, 1.0663],
          [1.7609, 0.6599]]]])
myParam   tensor([0.6235])
tensor([[[[0.7500, 0.7500],
          [1.0000, 0.5000]]]], grad_fn=<DivBackward0>)
after ---------------------
w   tensor([[[[1.1107, 1.0663],
          [1.7609, 0.6599]]]])
myParam   tensor([0.6235])