Indexing a tensor from with a different mask size mask

Hi,
I have a tensor of size [24,14, 14, 30] ([Batch_size, window_H, window_W, predictions]) and the mask of size [24, 14, 14].

I want only the predictions for the windows where the mask is 1.
So, my output vector could be of size [24,14, 14, 30] or just [30].

But I am unable to index using mask.

target_tensor.shape 
[24, 14, 14, 30]

contains_object_mask.shape
[24, 14, 14]

Result_tensor.shape
[24, 14, 14, 30]
or
[30]

Thank You