Skip to content

Fix bug: RuntimeError: set_sizes_contiguous is not allowed on Tensor …#17

Open
gachiemchiep wants to merge 1 commit into
timy90022:masterfrom
gachiemchiep:master
Open

Fix bug: RuntimeError: set_sizes_contiguous is not allowed on Tensor …#17
gachiemchiep wants to merge 1 commit into
timy90022:masterfrom
gachiemchiep:master

Conversation

@gachiemchiep
Copy link
Copy Markdown

When i tried your source with newer version of pytorch (1.4) the following error happened.

Traceback (most recent call last):
  File "test_net.py", line 276, in <module>
    im_data.data.resize_(data[0].size()).copy_(data[0])
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)

So i add a pr to fix it.

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

Successfully merging this pull request may close these issues.

1 participant