[DDP] Test inference works with eval() and no_grad() (#59666)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/59666
Tests that inference with DDP model won't hang when user sets eval()
or no_grad(). Note that if the model has a syncBN layer, they need both eval()
and no_grad() as eval() makes SyncBN work like a regular BN layer.
ghstack-source-id: 131906625
Test Plan: CI
Reviewed By: SciPioneer
Differential Revision: D28974146
fbshipit-source-id: 137f8245b1c303beb2416518476e70fe67c73376