The loss in your code is only sigmaA + sigmaB, without other task loss like cross_entropy loss.
In my code the loss is complicated  loss = (1/(2*sigma_A))loss_A+ (1/(2sigma_B)) * loss_B + log_sigma_A + log_sigma_B
When i call loss.backward(), I got no grad in  log_sigma_A and  log_sigma_B