![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
tensorflow
zkw_1998
白天有说有笑,晚上睡个好觉
展开
-
Python报错-AttributeError: module ‘tensorflow‘ has no attribute ‘global_variables_initializer‘的解决方法
一、报错截图:二、报错原因:TensorFlow2.0及以上版本没有global_variables_initializer这个属性三、解决方法:在代码里添加下面这行代码tf.compat.v1.disable_eager_execution()原先的:init = tf.global_variables_initializer()修改为:init = tf.compat.v1.global_variables_initializer()就可以了~...原创 2021-10-18 17:15:55 · 4353 阅读 · 0 评论 -
Python报错-AttributeError: module ‘tensorflow._api.v2.train‘ has no attribute ‘GradientDescentOptimize
一、报错截图:二、报错原因:TensorFlow2.0及以上版本没有GradientDescentOptimizer这个属性三、解决方法:原先的optimizer = tf.train.GradientDescentOptimizer(learning_rate).minimize修改为:optimizer = tf.compat.v1.train.GradientDescentOptimizer(learning_rate).minimize就可以了~...原创 2021-10-18 17:07:30 · 14194 阅读 · 1 评论 -
Python报错-AttributeError: module ‘tensorflow‘ has no attribute ‘random_normal‘的解决方法
一、报错截图:二、报错原因:TensorFlow2.0及以上版本已经把random_normal方法换为:random.normal 了三、解决方法:把random_normal改为random.normalW = tf.Variable(tf.random.normal([1]), name="weight")就可以了~原创 2021-10-18 16:41:18 · 3377 阅读 · 1 评论 -
Python报错-Could not load dynamic library ‘cudart64_101.dll‘…… if you do not have a GPU的解决方法
一、报错如下:2021-10-18 15:44:59.182284: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found2021-10-18 15:44:59.182515: I tensorflow/stream_executor/cuda/cudart原创 2021-10-18 16:19:06 · 986 阅读 · 0 评论 -
Python报错-AttributeError: module ‘tensorflow‘ has no attribute ‘placeholder‘的解决方法
一、报错截图:二、报错原因:TensoFlow2.0版本没有placeholder这个属性三、解决方法:在代码里添加下面这行代码tf.compat.v1.disable_eager_execution()原先的修改为:X = tf.compat.v1.placeholder("float")Y = tf.compat.v1.placeholder("float")就可以了~...原创 2021-10-18 16:36:53 · 3759 阅读 · 1 评论