No, it cannot, because

the tensors will still be there,
the building of the graph (what consumes the gpu memory) happens before the masking, so it would not help,
the autograd does not know which bits you don’t need because autograd only works with tensor-level information.

So you could only save something if you had separate tensors and could avoid using some of them and let them go out of scope.
Best regards
Thomas