Make getCustomClassTypeImpl a plain function
This function already does type-erasure in the form of `typeid`,
so by moving the `typid` call into the caller it not longer has to be
a template. This has benefits for binary size, and means the type map
iteself no longer has to be exported.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76549
Approved by: https://github.com/albanD