facebookresearch / deepcluster

Deep Clustering for Unsupervised Learning of Visual Features
Other
1.69k stars 325 forks source link

RuntimeError: invalid argument 5: k not in range for dimension at /opt/conda/conda-bld/pytorch_1556653000816/work/aten/src/THC/generic/THCTensorTopK.cu:21 #48

Closed junjianli106 closed 5 years ago

junjianli106 commented 5 years ago
(pytorch27) root@6b93e8c68090:~/userfolder/deepcluster# bash eval_linear.sh 
=> loading checkpoint '/root/userfolder/exp/checkpoints/checkpoint.pth.tar'
Loaded
Traceback (most recent call last):
  File "eval_linear.py", line 320, in <module>
    main()
  File "eval_linear.py", line 136, in main
    train(train_loader, model, reglog, criterion, optimizer, epoch)
  File "eval_linear.py", line 246, in train
    prec1, prec5 = accuracy(output.data, target, topk=(1,5))
  File "eval_linear.py", line 208, in accuracy
    _, pred = output.topk(maxk, 1, True, True)
RuntimeError: invalid argument 5: k not in range for dimension at /opt/conda/conda-bld/pytorch_1556653000816/work/aten/src/THC/generic/THCTensorTopK.cu:21

When i run eval_linear.sh,This mistake has occurred. I don't know how to solve it. I hope you can help me.

junjianli106 commented 5 years ago

I've solved this problem

rupaliasma commented 4 years ago

Hey, can you please share how you have solved this problem because I am also getting the same type of error which m not able to solve.hope you can help me out. Thank you. File "main.py", line 301, in train(epoch) File "main.py", line 107, in train _, neighbor = torch.topk(dist.data,num_neighbor+1,largest=False) RuntimeError: invalid argument 5: k not in range for dimension at /opt/conda/conda-bld/pytorch_1579022034529/work/aten/src/THC/generic/THCTensorTopK.cu:23