I have set of masks on cuda/GPU corresponding to different objects in an image (shapes and sizes below)
masks.shape: torch.Size([10, 240, 320, 1])
masks[0].shape: torch.Size([240, 320, 1])
masks[0][:,:,0].shape: torch.Size([240, 320])
1: Can I produce union of the these masks using torch.tensor operation? so that I can apply all of those once on the image?
2: How do I invert the values in torch tensor? I mean for 1, turn into 0 and vice versa. I have tried to ~mytensor but it says the operator is only applicable to integer or bool values. I have got float values in my tensors i.e. [1.] etc.
I intent to do all these operations on GPU without moving data back on CPU.
Thank you.