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

set_sizes_contiguous is not allowed on a Tensor created from .data or .detach(). #7

Open
athulvingt opened this issue Dec 18, 2019 · 0 comments

Comments

@athulvingt
Copy link

input.data.resize_(real_cpu.size()).copy_(real_cpu)
RuntimeError: set_sizes_contiguous is not allowed on a Tensor created from .data or .detach().
If your intent is to change the metadata of a Tensor (such as sizes / strides / storage / storage_offset)
without autograd tracking the change, remove the .data / .detach() call and wrap the change in a with torch.no_grad(): block.
For example, change:
x.data.set_(y)
to:
with torch.no_grad():
x.set_(y)

@athulvingt athulvingt changed the title et_sizes_contiguous is not allowed on a Tensor created from .data or .detach(). set_sizes_contiguous is not allowed on a Tensor created from .data or .detach(). Dec 18, 2019
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