Solved by ptrblck in post #5 
              
              
                As far as I understand you problem, you have two matrices. Let’s name them m = [N, N] and x = [batch_size, N, N, F]. 
Somewhere in m are zeros and you would like to get the indices. 
Using these indices you would like to set all matrices in x for each batch and each F to zero. 
Is this the right und…