The code will run just fine yes.
But no gradients will flow back along the mask as the ops to create it are not differentiable.
But gradients will properly flow back along all the entries in the loss that were kept.