fix error message for type_as (#57948) (#59535)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/59535
Improve error message for type_as and add unit test.
Test Plan: Imported from OSS
Reviewed By: nikithamalgifb, ansley
Differential Revision: D29046605
Pulled By: SplitInfinity
fbshipit-source-id: 978bceeb62e4d3c68815cd5fdf160909a99d00f2
Co-authored-by: hwangdeyu <deyhuang@qq.com>