Make TORCH_WARN_ONCE capture variables by reference (#26289)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/26289
It's not possible to refer to values of local variables otherwise.
ghstack-source-id: 90160797
Test Plan: The code compiles.
Differential Revision: D17397702
fbshipit-source-id: 49c74c44c88f197264603e4978e3d60bf199f6ac