Thanks for your answer but now there is a new error. I wrote the code above.
c:/Users/Richard/Desktop/python/AI/catordog.py:68: UserWarning: Implicit dimension choice for log_softmax has been deprecated. Change the call to include dim=X as an argument.
  output = F.log_softmax(x)
Traceback (most recent call last):
  File "c:/Users/Richard/Desktop/python/AI/catordog.py", line 110, in <module>
    train()
  File "c:/Users/Richard/Desktop/python/AI/catordog.py", line 86, in train
    loss = criterion(out, target)
  File "C:\Users\Richard\AppData\Local\Programs\DeepLearningStudio\user_data\data\1\user_conda\lib\site-packages\torch\nn\functional.py", line 2264, in nll_loss
    ret = torch._C._nn.nll_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
RuntimeError: Expected object of scalar type Long but got scalar type Float for argument #2 'target' in call to _thnn_nll_loss_forward