AttributeError: 模块“tensorflow.python.framework.ops"没有属性“RegisterShape" [英] AttributeError: module 'tensorflow.python.framework.ops' has no attribute 'RegisterShape'

查看:115
本文介绍了AttributeError: 模块“tensorflow.python.framework.ops"没有属性“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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆