Support `getattr` for ConstantVariable when compiling with Dynamo (#98153)
This PR enables `getattr` on ConstantVariable by implementing its `call_hasattr` function.
Fixes #97480
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98153
Approved by: https://github.com/ezyang