ptrblck:

However, I don’t think the alpha channel should just be the red channel from the same image, so you might want to use torch.cat((torch.ones(H, W, 1), tensor), 2) instead.


Could you explain what you mean with  I don't think the alpha channel should just be the red channel from the same image?
Using torch.cat((torch.ones(h, w, 1), tensor), 2) or torch.cat((torch.cuda.FloatTensor(h, w, 1).fill_(1), tensor), 2) to directly initialize the tensor on the gpu. I get something that seems like its completely tinted red.

red_ting.PNG514×544 116 KB

swapping the tensors passed into torch.cat around like torch.cat((tensor, torch.cuda.FloatTensor(h, w, 1).fill_(1)), 2) gives me the desired output.

normal.PNG514×544 122 KB

I appreciate your help a lot !