您需要先登录或注册,然后才能继续。
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
想要评论请 注册 或 登录