kimhc6028 / soft-decision-tree

pytorch implementation of "Distilling a Neural Network Into a Soft Decision Tree"
https://arxiv.org/pdf/1711.09784.pdf
BSD 3-Clause "New" or "Revised" License
282 stars 59 forks source link

when I try to run this demo, I met a mistake. I could not figure out why? #2

Open littlehacker26 opened 6 years ago

littlehacker26 commented 6 years ago

Traceback (most recent call last): File "C:/Users/woaifish/Desktop/android/soft-decision-tree-master/main.py", line 100, in model.train(train_loader, epoch) File "C:\Users\woaifish\Desktop\android\soft-decision-tree-master\model.py", line 193, in train loss, output = self.cal_loss(data, self.target_onehot) File "C:\Users\woai_fish\Desktop\android\soft-decision-tree-master\model.py", line 133, in cal_loss leaf_accumulator = self.root.cal_prob(x, self.path_prob_init) File "C:\Users\woai_fish\Desktop\android\soft-decision-tree-master\model.py", line 58, in cal_prob self.prob = self.forward(x) # probability of selecting right node File "C:\Users\woai_fish\Desktop\android\soft-decision-tree-master\model.py", line 48, in forward return (F.sigmoid(self.beta * self.fc(x))) File "E:\Conda\envs\android\lib\site-packages\torch\autograd\variable.py", line 757, in mul return self.mul(other) File "E:\Conda\envs\android\lib\site-packages\torch\autograd\variable.py", line 301, in mul return Mul.apply(self, other) File "E:\Conda\envs\android\lib\site-packages\torch\autograd_functions\basic_ops.py", line 50, in forward return a.mul(b) RuntimeError: inconsistent tensor size at d:\downloads\pytorch-master-1\torch\lib\th\generic/THTensorMath.c:847

kimhc6028 commented 6 years ago

I cannot reproduce this error. Would you tell me exactly what you did? and your pytorch/python version

littlehacker26 commented 6 years ago

Yes,I also suspected this issue!I am trying to try another python version!Can you tell me your tools version that have no errors? My Version Message: python=3.6 torch=0.1.12

kimhc6028 commented 6 years ago

python 3.5.2 pytorch 0.3.1

littlehacker26 commented 6 years ago

Thanks you very much! I will try it latter!

kiki28 commented 5 years ago

I can't find pytorch 0.3.1!

kimhc6028 commented 5 years ago

@kiki28 This repo is updated to match pytorch 0.4.0. Please pull master branch again, and update your pytorch to 0.4.0. That should work.