FlowNetPytorch icon indicating copy to clipboard operation
FlowNetPytorch copied to clipboard

RuntimeError: input1 must be contiguous

Open SBaokun opened this issue 1 year ago • 1 comments

thanks for your work!!! i get some mistakes: File "/home/ilab/anaconda3/envs/sc_sfmlearner/lib/python3.7/site-packages/spatial_correlation_sampler/spatial_correlation_sampler.py", line 42, in spatial_correlation_sample stride, padding, dilation, dilation_patch) File "/home/ilab/anaconda3/envs/sc_sfmlearner/lib/python3.7/site-packages/spatial_correlation_sampler/spatial_correlation_sampler.py", line 70, in forward dH, dW) RuntimeError: input1 must be contiguous How can I solve this problem?

thank you!!!!

SBaokun avatar Mar 04 '23 14:03 SBaokun

Hello,

See similar issue here : https://github.com/alexandrosstergiou/SoftPool/issues/6

Issue is that your input tensor is not contiguous, probably because you used some stride (something like my_tensor[..., ::2]) or some transpose without copying. The easy solution is simply to make it contiguous, i.e. it will copy the data into a nicely shaped tensor if it's not contiguous, and do nothing if it's already contiguous :+1:

my_tensor = my_tensor.contiguous()

ClementPinard avatar Mar 06 '23 14:03 ClementPinard