Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Expected object of type torch.cuda.FloatTensor but found type torch.cuda.LongTensor for argument #2 'other' #20

Closed
zhangxgu opened this issue Sep 11, 2018 · 2 comments

Comments

@zhangxgu
Copy link

The results of running python main.py ...... are showed as following:

Traceback (most recent call last):
File "main.py", line 424, in
main(RunContext(file, 0))
File "main.py", line 104, in main
train(train_loader, model, ema_model, optimizer, epoch, training_log)
File "main.py", line 274, in train
meters.update('top1', prec1[0], labeled_minibatch_size)
File "/home/gzx/Meanteacher/mean-teacher/pytorch/mean_teacher/utils.py", line 53, in update
self.meters[name].update(value, n)
File "/home/gzx/Meanteacher/mean-teacher/pytorch/mean_teacher/utils.py", line 86, in update
self.sum = self.sum +(val * n)
RuntimeError: Expected object of type torch.cuda.FloatTensor but found type torch.cuda.LongTensor for argument #2 'other'

Is this because I install pytorch by using conda? The pytorch version is 0.4.1

@tarvaina
Copy link
Contributor

Hi.

Yes, I think it’s a Pytorch version issue. Please try 0.3.1 and let me know if it solves the problem.

Antti

@zhangxgu
Copy link
Author

@tarvaina
I have changed the pytorch version to 0.3.1 and it works, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants