Add torch dispatch mode to ProxyTensor tracing (#77174)
Uses a mode for ProxyTensor tracing so that it traces factory functions as well
cc @dhruvbird
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77174
Approved by: https://github.com/ezyang