It is a simple two layer NN that tries to learn a transformation.
Is multiplying the input with the mask sufficient? It will nullify the samples but I think It will still calculate the gradient for those.