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: set_sizes_contiguous is not allowed on Tensor created from .data or .detach(), in Pytorch 1.1.0 #9

Open
HHHedo opened this issue Aug 1, 2019 · 3 comments

Comments

@HHHedo
Copy link

HHHedo commented Aug 1, 2019

My pytorch is 1.1.0.
x.data.resize(batchSize, inputSize, 1)_ in NCEAverage.py doesn't work.
with torch.no_grad(): x.resize(batchSize, inputSize, 1)_ still doesn't work.
I replaced it as _ x.unsqueeze(2))_ .
I wonder if this function works the same as x.data.resize(batchSize, inputSize, 1)_

@ChongjianGE
Copy link

Hi, there. Have you solved the compatibility of Pytorch?

@robert780612
Copy link

Use torch.reshape
out = torch.bmm(weight, torch.reshape(x, (batchSize, inputSize, 1)))

@Crestina2001
Copy link

It seems that robert's suggestions can work, but gradOutput.data.resize_(batchSize, 1, K+1) in around line 60 should be changed to gradOutput.resize_(batchSize, 1, K + 1).

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

4 participants