Fix cpp_custom_type_hack variable handling (#19400)
Summary:
My bad - it might be called in variable and non-variable context. So it's better to just inherit variable-ness from the caller.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/19400
Reviewed By: ezyang
Differential Revision: D14994781
Pulled By: dzhulgakov
fbshipit-source-id: cb9d055b44a2e1d7bbf2e937d558e6bc75037f5b