This line of code is creating the issue:
loss = loss(outputs, target)

since loss is passed as an argument to train_one_epoch.
Change the loss function object name to criterion in train_one_epoch and it should work.