Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check hasattr on the type, not the instance.
hasattr on the instance triggers __getattr__ which carries very undesirable effects, such as running Ops on a donated buffer. Long term, we may want to audit all uses of hasattr on TensorFlow instances that overrides __getattr__ in nontrival (e.g. running tf Ops) ways. They will almost always cause trouble here and there because TensorFlow is quite far from being able guarantee if an Op returns or consumes is actually valid in all cases. Things will improve give it time, but if we can avoid such strong assumptions the system tend to get more robust. PiperOrigin-RevId: 578261984
- Loading branch information