[DDP] unittest for when params arent used in backward pass (#52384)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/52384
Adds a simple UT with unittest that we can modify when we enable DDP backward without needing all parameters to get gradient.
ghstack-source-id: 122001930
Test Plan: CI
Reviewed By: zhaojuanmao
Differential Revision: D26482479
fbshipit-source-id: c80bdeea7cf9db35390e385084ef28d64ed239eb