When to make tensor contiguous manually?

Many times after using a view or transpose function we need to manually apply the .contiguous() to make the tensor contiguous for further operations.
Usually I get to know about this after getting an error saying make it contiguous.

Is there any tip when to use contiguous option, it’s a bit irritating to wait for errors. Also I have seen that it changed between pytorch version. A code that works in pytorch 0.4 didnt work with pytorch .3 until I used the contiguous option.

Which operations are throwing this error for you? There shouldn’t really be any tensor contiguity expectations, so it’s probably a bug.

Hi, can’t reproduce error again sorry. But it comes a lot after reshape, squeeze and transpose operations.

Link to a Past Question I asked when I faced that error. Although I can’t reproduce it again :confused: , probably that error occurred in my model after alot of operations and (possibly) combined effect on them.

Anyway thanks!!

Okay, sounds good. Thanks for the report, and if you run into it again please let us know!