AttributeError: 模块“tensorflow.python.framework.ops"没有属性“RegisterShape" [英] AttributeError: module 'tensorflow.python.framework.ops' has no attribute 'RegisterShape'
问题描述
我使用的是 TensorFlow 2.1.0-dev20191125
I am using TensorFlow 2.1.0-dev20191125
不幸的是,我无法编译一个有错误的简单示例:
Unfortunately I can't compile a simple example with error:
"AttributeError: 模块 'tensorflow.python.framework.ops' 没有属性 'RegisterShape'"
"AttributeError: module 'tensorflow.python.framework.ops' has no attribute 'RegisterShape'"
我的源代码:
from tensorflow.python.framework import ops as _ops
_ops.RegisterShape("GRUBlockCell")(None)
看起来是不是安装错误TF
?
Is it looks like incorrectly installed TF
?
推荐答案
核心 ops
的形状函数已通过 REGISTER_OP(...).SetShapeFn(...) 移至 C++代码>.因此,您可能必须首先在
C++
中创建/注册您的操作.
Shape functions for core ops
were moved to C++ via REGISTER_OP(...).SetShapeFn(...)
. So you may have to first create/register your operation in C++
.
可以在官方文档中找到详细指南这里
A detailed guide can be found in the official doumentation Here
这篇关于AttributeError: 模块“tensorflow.python.framework.ops"没有属性“RegisterShape"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!