I want to solve the problem of pytorch program about cuda.The error is as follows:
Traceback (most recent call last):
File “C:\Users\hp\Downloads\pytorch-master\train.py”, line 371, in 
fire.Fire(train)
File “C:\Users\hp\Anaconda3\envs\tf-gpu\lib\site-packages\fire\core.py”, line 138, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File “C:\Users\hp\Anaconda3\envs\tf-gpu\lib\site-packages\fire\core.py”, line 468, in _Fire
target=component.name)
File “C:\Users\hp\Anaconda3\envs\tf-gpu\lib\site-packages\fire\core.py”, line 672, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File “C:\Users\hp\Downloads\pytorch-master\train.py”, line 349, in train
n_epochs=n_epochs, batch_size=batch_size, seed=seed)
File “C:\Users\hp\Downloads\pytorch-master\train.py”, line 226, in trainmodel
n_epochs=n_epochs,
File “C:\Users\hp\Downloads\pytorch-master\train.py”, line 108, in trainmodel_epoch
loss = torch.nn.functional.cross_entropy(output, target)
File “C:\Users\hp\Anaconda3\envs\tf-gpu\lib\site-packages\torch\nn\functional.py”, line 2324, in cross_entropy
return nll_loss(log_softmax(input, 1), target, weight, None, ignore_index, None, reduction)
File “C:\Users\hp\Anaconda3\envs\tf-gpu\lib\site-packages\torch\nn\functional.py”, line 2115, in nll_loss
ret = torch._C._nn.nll_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
RuntimeError: Expected object of device type cuda but got device type cpu for argument #1 ‘self’ in call to _thnn_nll_loss_forward
Please answer.Thanks in advance!