Hello, I have just

make a fresh install of conda
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

Then Get a new error 
Traceback (most recent call last):
  File "bugs.py", line 333, in <module>
    loss.backward()
  File "...python3.7/site-packages/torch/tensor.py", line 195, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph)
  File ".../python3.7/site-packages/torch/autograd/__init__.py", line 99, in backward
    allow_unreachable=True)  # allow_unreachable flag
RuntimeError: Expected a Tensor of type Variable but found an undefined Tensor for argument #0 'self'