Skip to content
代码片段 群组 项目
提交 e44f8a08 编辑于 作者: Yu Feng's avatar Yu Feng 提交者: TensorFlower Gardener
浏览文件

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
上级 48915840
分支
标签 v1.0.0
无相关合并请求
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册