[WIP] Update foreach APIs to use scalar lists (#48223)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/48223
Test Plan: Imported from OSS
Reviewed By: zou3519
Differential Revision: D25074763
Pulled By: izdeby
fbshipit-source-id: 155e3d2073a20d16bdbe358820170bf53f93c7a5