Port `prod` kernel to structured kernels. (#62024)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/62024
Tracking issue: #55070
In this PR, I also broke down the meta functions of other reduction kernels (e.g. `all`,
`argmax`, `sum`) into the composition of common patterns.
Test Plan: Imported from OSS
Reviewed By: ejguan
Differential Revision: D29847122
Pulled By: ezyang
fbshipit-source-id: a6680a6cf6e59bb46b8ffe7bf2a3a611d6e0fd14