Solved by ptrblck in post #2 
              
              
                You could create the masks containing zeros for the black boxes and ones everywhere else, and multiply the normalized input tensor with it.