loeweX/Greedy_InfoMax

CUDNN_STATUS_NOT_SUPPORTED error caused by non-contiguous variable

k-stacke opened this issue · 1 comments

Thanks for making the code available.

When running the command python -m GreedyInfoMax.vision.main_vision --download_dataset --save_dir vision_experiment I had problems with the following error:

CUDNN_STATUS_NOT_SUPPORTED. This error may appear if you passed in a non-contiguous input.

I traced the problem to the forward pass in Resnet_Encoder:

out = F.adaptive_avg_pool2d(z, 1)
out = out.reshape(-1, n_patches_x, n_patches_y, out.shape[1])
out = out.permute(0, 3, 1, 2)

The permute() operation seems to make the variable out non-contiguous (see https://stackoverflow.com/questions/48915810/pytorch-contiguous for discussion).

The issue is solved by making it contiguous again:

out = F.adaptive_avg_pool2d(z, 1)
out = out.reshape(-1, n_patches_x, n_patches_y, out.shape[1])
out = out.permute(0, 3, 1, 2).contiguous()

I hope this helps if someone help gets a similar problem.

System specifics:
Ubuntu 16.04.6 LTS
Python 3.6
CUDA 10.0
cudnn 7.6.4
Pytorch 1.4.0

Thanks for spotting it! Could you send a pull-request, so I can give you credit while adding it to the repo?