<p dir="auto">The code and dataset were the same as before, but I got the following error. However they could work well about a half mouth ago.<br>
the pytorch's version is 0.3.1<br>
raceback (most recent call last):<br>
File "main.py", line 341, in<br>
main()<br>
File "main.py", line 141, in main<br>
train(train_loader, model, criterion, optimizer, epoch)<br>
File "main.py", line 192, in train<br>
prec1, prec5 = accuracy(output.data, target, topk=(1,5))<br>
File "main.py", line 329, in accuracy<br>
_, pred = output.topk(maxk, 1, True, True)<br>
RuntimeError: invalid argument 5: k not in range for dimension at /pytorch/torch/lib/THC/generic/THCTensorTopK.cu:21<br>
/pytorch/torch/lib/THCUNN/ClassNLLCriterion.cu:101: void cunn_ClassNLLCriterion_updateOutput_kernel(Dtype *, Dtype *, Dtype *, long *, Dtype *, int, int, int, int, long) [with Dtype = float, Acctype = float]: block: [0,0,0], thread: [0,0,0] Assertion t &gt;= 0 &amp;&amp; t &lt; n_classes failed.<br>
/pytorch/torch/lib/THCUNN/ClassNLLCriterion.cu:101: void cunn_ClassNLLCriterion_updateOutput_kernel(Dtype *, Dtype *, Dtype *, long *, Dtype *, int, int, int, int, long) [with Dtype = float, Acctype = float]: block: [0,0,0], thread: [1,0,0] Assertion t &gt;= 0 &amp;&amp; t &lt; n_classes failed.<br>
/pytorch/torch/lib/THCUNN/ClassNLLCriterion.cu:101: void cunn_ClassNLLCriterion_updateOutput_kernel(Dtype *, Dtype *, Dtype *, long *, Dtype *, int, int, int, int, long) [with Dtype = float, Acctype = float]: block: [0,0,0], thread: [2,0,0] Assertion t &gt;= 0 &amp;&amp; t &lt; n_classes failed.<br>
/pytorch/torch/lib/THCUNN/ClassNLLCriterion.cu:101: void cunn_ClassNLLCriterion_updateOutput_kernel(Dtype *, Dtype *, Dtype *, long *, Dtype *, int, int, int, int, long) [with Dtype = float, Acctype = float]: block: [0,0,0], thread: [3,0,0] Assertion t &gt;= 0 &amp;&amp; t &lt; n_classes failed.<br>
THCudaCheck FAIL file=/pytorch/torch/lib/THC/generic/THCStorage.c line=184 error=59 : device-side assert triggered<br>
terminate called after throwing an instance of 'std::runtime_error'<br>
what(): cuda runtime error (59) : device-side assert triggered at /pytorch/torch/lib/THC/generic/THCStorage.c:184<br>
Aborted (core dumped)</p>
<p dir="auto">The code and dataset were the same as before, but I got the following error. However they could work well about a half mouth ago.<br>
the pytorch's version is 0.3.1, BUT I find the version 0.4.0 also meeting with the same error<br>
raceback (most recent call last):<br>
File "main.py", line 341, in<br>
main()<br>
File "main.py", line 141, in main<br>
train(train_loader, model, criterion, optimizer, epoch)<br>
File "main.py", line 192, in train<br>
prec1, prec5 = accuracy(output.data, target, topk=(1,5))<br>
File "main.py", line 329, in accuracy<br>
_, pred = output.topk(maxk, 1, True, True)<br>
RuntimeError: invalid argument 5: k not in range for dimension at /pytorch/torch/lib/THC/generic/THCTensorTopK.cu:21<br>
/pytorch/torch/lib/THCUNN/ClassNLLCriterion.cu:101: void cunn_ClassNLLCriterion_updateOutput_kernel(Dtype *, Dtype *, Dtype *, long *, Dtype *, int, int, int, int, long) [with Dtype = float, Acctype = float]: block: [0,0,0], thread: [0,0,0] Assertion t &gt;= 0 &amp;&amp; t &lt; n_classes failed.<br>
/pytorch/torch/lib/THCUNN/ClassNLLCriterion.cu:101: void cunn_ClassNLLCriterion_updateOutput_kernel(Dtype *, Dtype *, Dtype *, long *, Dtype *, int, int, int, int, long) [with Dtype = float, Acctype = float]: block: [0,0,0], thread: [1,0,0] Assertion t &gt;= 0 &amp;&amp; t &lt; n_classes failed.<br>
/pytorch/torch/lib/THCUNN/ClassNLLCriterion.cu:101: void cunn_ClassNLLCriterion_updateOutput_kernel(Dtype *, Dtype *, Dtype *, long *, Dtype *, int, int, int, int, long) [with Dtype = float, Acctype = float]: block: [0,0,0], thread: [2,0,0] Assertion t &gt;= 0 &amp;&amp; t &lt; n_classes failed.<br>
/pytorch/torch/lib/THCUNN/ClassNLLCriterion.cu:101: void cunn_ClassNLLCriterion_updateOutput_kernel(Dtype *, Dtype *, Dtype *, long *, Dtype *, int, int, int, int, long) [with Dtype = float, Acctype = float]: block: [0,0,0], thread: [3,0,0] Assertion t &gt;= 0 &amp;&amp; t &lt; n_classes failed.<br>
THCudaCheck FAIL file=/pytorch/torch/lib/THC/generic/THCStorage.c line=184 error=59 : device-side assert triggered<br>
terminate called after throwing an instance of 'std::runtime_error'<br>
what(): cuda runtime error (59) : device-side assert triggered at /pytorch/torch/lib/THC/generic/THCStorage.c:184<br>
Aborted (core dumped)</p>