You are disabling the gradient calculation and are rewrapping the loss tensor thus detaching it from the graph in these lines of code:
           with torch.no_grad():
                output = C(x) 
                loss = criteron(output, label.long())
            
            loss = Variable(loss, requires_grad = True)

Remove the with torch.no_grad() guard and don’t recreate the loss tensor.
Also, Variables are deprecated since PyTorch 0.4 so you can use tensors now.