Dear ptrblck, thanks for the quick response.
I’m still confused on how I can insert your suggested snippet, given the appropriate changes, into the code itself. Would you mind to elaborate it a little bit further? I’ve had some experience with Python before, but still learning and improving with Pytorch.
By the way, just for testing, changing torch.empty for torch.zeros didn’t crash cuda, confirming what you proposed. But I still can’t understand why, for an image with only black and red pixels, the resulting tensor with unique values in rgb from the mask are still ranging from 0 to 255 (with some intermediate values missing as well, e.g., 88, 89…). I’m still trying to debug why the code is reading those values out of the mask.
Any further clarifications would be greatly appreciated and once again thanks for the support.