How to boradcast a mask?

I have a tensor 100 x 50 x 60, and I have a mask acting on images 50 x 60 and selects some 1000 pixels of interst (out of 30,000 in that image).

When I apply the mask to the tensor mentioned in the beginning, it throws an error and doesn’t broadcast to the 100 images. I want an output like this : 100 x 1000 i.e. the mask applied to 100 images (batch size).

If there’s no way to broadcast mask in Pytorch, how can I do it manually?

I think I got it.

tensor[: , mask]

Just that. It works at least, but I don’t know if it is correct.