hshustc / CVPR19_Incremental_Learning

Learning a Unified Classifier Incrementally via Rebalancing
185 stars 43 forks source link

Acctype = float]: block: [0,0,0], thread: [4,0,0] Assertion `t >= 0 && t < n_classes` failed. #10

Open yangzhaonan18 opened 4 years ago

yangzhaonan18 commented 4 years ago

bug information :

Epoch: 0, LR: [0.1] Train set: 196, Train Loss: 3.4775 Acc: 9.5960 /opt/conda/conda-bld/pytorch_1556653215914/work/aten/src/THCUNN/ClassNLLCriterion.cu:105: 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: [4,0,0] Assertion t >= 0 && t < n_classes failed.

I solved this by modified

https://github.com/hshustc/CVPR19_Incremental_Learning/blob/e5a90aed7640f3b00e5b1a8dfb5376c1628bfe6a/cifar100-class-incremental/class_incremental_cifar100.py#L141

to

tg_model = resnet_cifar.resnet32(num_classes=args.num_classes)


I'm not sure if I am correct。????

yangzhaonan18 commented 4 years ago

I'm sure i'm wrong

leopardyao commented 3 years ago

check your pytorch vision. if you use new pytorch vision, make sure you change train_data, train_label etcs. to data and targets to make sure the random selected labels are reindexed from 0 to max_num_classes