avirambh / MSDNet-GCN

ICLR 2018 reproducibility challenge - Multi-Scale Dense Convolutional Networks for Efficient Prediction

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

It seems a bug

mjjackey opened this issue · comments

I downloaded the code and run it by the command: python3 main.py --model msdnet -b 64 -j 2 cifar10 --msd-blocks 10 --msd-base 4 --msd-step 2 --msd-stepmode even --growth 6-12-24 --gpu 0 to train on cifar10 data set, but it shows the error

Traceback (most recent call last):
File "main.py", line 445, in
main()
File "main.py", line 139, in main
train(train_loader, model, criterion, optimizer, epoch)
File "main.py", line 212, in train
prec1, prec5, _ = msdnet_accuracy(output, target, input)
File "main.py", line 269, in msdnet_accuracy
top1s.append(tprec1[0])
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to c
onvert a 0-dim tensor to a Python number

Hi @mjjackey,
This code was developed with Pytorch 0.1.12, and it seems that after version 0.5, 0-dim tensor should be handled with an item() call. I think you can use Pytorch 0.4.0/1.
Pull requests for supporting later versions are welcome of course.

Thank you very much! @avirambh.
Sorry for the late reply, I have figured it out already.
And I have a question: how to vary the FLOPs or parameters to plot the figure for accuracy? Do I need to open a new issue for this question?

We used the script referred by the authors of the paper in the original torch repository. We created the graphs manually.

We used the script referred by the authors of the paper in the original torch repository. We created the graphs manually.

@avirambh Hi, avirambn, I am confused that each classifier has been added in the code, but the FLOPs just be output once, how can I know FLOPs of each classifier for anytime prediction?

@mjjackey we did it manually. If i'm not mistaken, we added prints and checked different model architectures.

@avirambh Thank you very much for your timely response! Recently, I am studying this paper, so have a lot of questions. :)
In terms of this question, I have found it the prints adding in the ['Conv2d'], this could be not accurate because 'Conv2d' is not limited in classifiers.