[dynamo] Refactor TensorVariable method handling (#119111)
This should slightly improve compile times and be easier to maintain.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/119111
Approved by: https://github.com/yanboliang, https://github.com/anijain2305