（1）I set two learnable parameters w1，w2，and add them to optimizer
w1 = Variable(torch.Tensor([1]), requires_grad = True)
w2 = Variable(torch.Tensor([1]), requires_grad = True)
（2）I pass them to the function train()
（3）In train(),
loss = (1/torch.Tensor.exp(w1)) loss_task1 + (1/torch.Tensor.exp(w2)) loss_task2 + w1 + w2
loss.backward()
optimizer.step()
But I found that w1 and w2 have no gradient：
w1.grad is None
I want to know WHY and how to achieve this ‘dynamic loss weight learning’