Port `remainder` from TH to ATen (CPU and CUDA) (#34136)
Summary:
CPU issue https://github.com/pytorch/pytorch/issues/24753
CUDA issue https://github.com/pytorch/pytorch/issues/24615
Pull Request resolved: https://github.com/pytorch/pytorch/pull/34136
Differential Revision: D20375458
Pulled By: ezyang
fbshipit-source-id: 1a9fb39a7e2d17a0d31bd14b211eaacea060e834