RuntimeError                              Traceback (most recent call last)
~/Ternary-Weights-Network/main.py in ()
138
139 if name == ‘main’:
–> 140     main()
~/Ternary-Weights-Network/main.py in main()
81     for epoch_index in range(1,args.epochs+1):
82         adjust_learning_rate(learning_rate,optimizer,epoch_index,args.lr_epochs)
—> 83         train(args,epoch_index,train_loader,model,optimizer,criterion)
84         acc = test(args,model,test_loader,criterion)
85         if acc > best_acc:
~/Ternary-Weights-Network/main.py in train(args, epoch_index, train_loader, model, optimizer, criterion)
96         optimizer.zero_grad()
97
—> 98         output = model(data)
99         loss = criterion(output,target)
100         loss.backward()
~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
475             result = self._slow_forward(*input, **kwargs)
476         else:
–> 477             result = self.forward(*input, **kwargs)
478         for hook in self._forward_hooks.values():
479             hook_result = hook(self, input, result)
~/Ternary-Weights-Network/model.py in forward(self, x)
75         self.fc2 = TernaryLinear(512,10)
76     def forward(self,x):
—> 77         x = self.conv1(x)
78         x = F.relu(F.max_pool2d(self.bn_conv1(x),2))
79         x = self.conv2(x)
~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
475             result = self._slow_forward(*input, **kwargs)
476         else:
–> 477             result = self.forward(*input, **kwargs)
478         for hook in self._forward_hooks.values():
479             hook_result = hook(self, input, result)
~/Ternary-Weights-Network/model.py in forward(self, input)
61         super(TernaryConv2d,self).init(*args,**kwargs)
62     def forward(self,input):
—> 63         self.weight.data = Ternarize(self.weight.data)
64         out = F.conv2d(input, self.weight, self.bias, self.stride,self.padding, self.dilation, self.groups)
65         return out
~/Ternary-Weights-Network/model.py in Ternarize(tensor)
14     output = torch.zeros(tensor.size())
15     delta = Delta(tensor)
—> 16     alpha = Alpha(tensor,delta)
17     for i in range(tensor.size()[0]):
18         for w in tensor[i].view(1,-1):
~/Ternary-Weights-Network/model.py in Alpha(tensor, delta)
34             count = truth_value.sum()
35             abssum = torch.matmul(absvalue,truth_value.type(torch.FloatTensor).view(-1,1))
—> 36             Alpha.append(abssum/count)
37         alpha = Alpha[0]
38         for i in range(len(Alpha) - 1):
RuntimeError: Expected object of type torch.FloatTensor but found type torch.LongTensor for argument #2 ‘other’
Help needed, thanks in advance