Factor automatic dynamic into a private helper function (#101114)
Simple cleanup; makes it easier to disable automatic dynamic for nested tensors.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/101114
Approved by: https://github.com/ezyang