Thanks for your patience. It is my careless that I don’t understand .detach() well.
And if I set the parameters like this,
self.scale = nn.Parameter(torch.randn(1,self.out_features),requires_grad = True)
self.shift = nn.Parameter(torch.randn(1,self.out_features),requires_grad = True)
self.a = nn.Parameter(torch.randn(1,self.out_features),requires_grad = True)
self.b = nn.Parameter(torch.randn(1,self.out_features),requires_grad = True)

I get the result like this.

My loss functions set like this.
loss_func1 = nn.MSELoss()
loss_func2 = nn.CrossEntropyLoss()
loss1 = loss_func1(decoded, b_y.float())      # mean square error
loss2 = loss_func2(out, labels)
loss = loss1 + loss2

What are the possible reasons for this phenomenon? Gradient vanishing?
Thank you for your time.