I think it’s possible.
However, as I’m not completely sure how you would like to index your image tensors, could you please post a sample image batch, the corresponding indices, and what the result should look like?
I guess you could use the .nonzero() method to get all necessary indices, but if you post a small example, I could write some dummy code. 
idx = torch.tensor([0, 1, 0, 1, 0, 1, 0 ,1])
(idx == 1).nonzero()  # gives all indices of nonzero values
(idx == 0).nonzero()  # gives all indices of zero values

@DoubtWang Thanks for the catch!