您的位置:首页 > 编程语言 > Python开发

解决:AttributeError: module ‘tensorflow.python.framework.ops‘ has no attribute ‘RegisterShape‘

2020-08-01 09:28 176 查看

tensorflow 2版本读取MNIST数据集,使用 read_data_sets,在导入时报错

from tensorflow.examples.tutorials.mnist import input_data
AttributeError: module 'tensorflow.python.framework.ops' has no attribute 'RegisterShape'

查网上说法是tf2版本已经弃用了

read_data_sets
,但我这个报错原因不知道是不是因为这个,总之在导入时就出错
解决:换如下加载MNIST方法:

import tensorflow as tf

mnist = tf.keras.datasets.mnist
(X_train, y_train), (X_test, y_test) = mnist.load_data()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐