The forward method of your model returns a tuple via:
return output, x    # return x for visualization

which creates the issue in loss = criterion(outputs, labels).
I assume you want to use output to calculate the loss, so use:
        output, x = model(inputs)
        loss = criterion(output, labels)

and it should work.