Moves torch cpu math tests to device-generic framework (#35658)
Summary:
Per title. Also, replaces reference computation with `math.xx` functions and torch.apply_ with numpy/scipy as appropriate.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/35658
Differential Revision: D20744541
Pulled By: ngimel
fbshipit-source-id: a16ea506397c07f09f0d7f1c54fd8017418bd506