![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
TensorFlow
我是硝酸钾
大家好,我是硝酸钾!Coding for A Better Life!
展开
-
TensorFlow问题:AttributeError: module ‘tensorflow‘ has no attribute ‘Session‘
import tensorflow as tf message = tf.constant('Welcome to the exciting world of Deep Neural Networks!') with tf.Session() as sess: print(sess.run(message).decode()) 报错: AttributeError: module 'tensorflow' has no attribute 'Session' 该错误是版本的问题,因为在新的T.原创 2021-08-24 10:08:38 · 288 阅读 · 0 评论 -
TensorFlow的变量
常量:常量是其值不能改变的张量。 变量:当一个量在会话中的值需要更新时,使用变量来表示。例如,在神经网络中,权重需要在训练期间更新,可以通过将权重声明为变量来实现。变量在使用前需要被显示初始化。另外需要注意的是,常量存储在计算图的定义中,每次加载图时都会加载相关变量。换句话说,它们是占用内存的。另一方面,变量又是分开存储的。它们可以存储在参数服务器上。 占位符:用于将值输入 TensorFlow 图中。它们可以和 feed_dict 一起使用来输入数据。在训练神经网络时,它们通常用于提供新的训练样本。在原创 2021-08-24 09:55:51 · 163 阅读 · 0 评论