HighwayWu/ImageInpainting

Issue in attention network

vinits5 opened this issue · 2 comments

RuntimeError: invalid argument 5: k not in range for dimension at /pytorch/aten/src/THC/generic/THCTensorTopK.cu:26

This error is attributed to the attention network where the topk function is being used. I have identified the output of F.interpolate(mask.clone(), (32, 32)).view(1, -1) has very few values that are equal to 1. Sometimes, none of the value is 1 and sometimes only one of the value is 1. This raises an issue in topk function.
Please let me know how can I resolve this error.

Thank you.

Hi, Vinits.

This is because the regions you want to inpaint (mask values are 1) is too small, i.e., usually less than 8*8 pixels. Therefore, a quick remedy is to enlarge your mask or add more regions to be inpainted.
Sorry for the late reply.

Best,
Haiwei

Thanks for the update.