Refactored math tests to iterate over all math ops
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/21511
Test Plan: Imported from OSS
Differential Revision: D16088193
Pulled By: Chillee
fbshipit-source-id: 81b6e536b4505178c829a9d925c30cd185b7a706