Would you create these tiles as a preprocessing step or would you like to process the image tensor?
In the latter case you could use tensor.unfold to create these patches.
Once you have the patches, you could check each patch, if it’s “empty” based on your condition and remove it.