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

TypeError: can't convert CUDA tensor to numpy. #14

Open
CyKaMing opened this issue Jun 22, 2019 · 0 comments
Open

TypeError: can't convert CUDA tensor to numpy. #14

CyKaMing opened this issue Jun 22, 2019 · 0 comments

Comments

@CyKaMing
Copy link

I am running with RTX2080ti python 3.6 , pytorch 1.0.1
But this error has shown up.

STEP 1000 x 15
Source to target (backtranslation)
Traceback (most recent call last):
File "train.py", line 20, in
undreamt.train.main_train()
File "/home/{mypath}/undreamt-master/undreamt/train.py", line 307, in main_train
logger.log(step)
File "/home/{mypath}/Translation/undreamt-master/undreamt/train.py", line 415, in log
.format(self.trainer.perplexity_per_word(), self.trainer.total_time(),
File "/home/{mypath}/Translation/undreamt-master/undreamt/train.py", line 357, in perplexity_per_word
return np.exp(self.loss/self.trg_word_count)
File "/home/{mypath}/anaconda3/envs/Translation/lib/python3.6/site-packages/torch/tensor.py", line 450, in array
return self.numpy()
TypeError: can't convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

Have any solutions, please?

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

1 participant