HighwayWu / ImageInpainting

36 stars 8 forks source link

Issue in attention network #4

Closed vinits5 closed 3 years ago

vinits5 commented 3 years ago

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.

HighwayWu commented 3 years ago

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

vinits5 commented 3 years ago

Thanks for the update.