In your training loop you are not zeroing out the gradients, which will thus accumulate them in each iteration.
Add optimizer.zero_grad() at the beginning of your DataLoader loop:
for (i, l) in trainloader:
    optimizer.zero_grad()
    i = ...

Besides that the code looks fine. 
Let me know, if that helps.