TF中的tf.Variable 和 tf.placehold 的区别
来源:互联网 发布:淘宝女装代理排除同款 编辑:程序博客网 时间:2024/05/16 12:39
参考自: https://stackoverflow.com/questions/36693740/whats-the-difference-between-tf-placeholder-and-tf-variable
tf.placehold 占位符。 主要为真实输入数据和输出标签的输入, 用于在 feed_dict中的变量,不需要指定初始值,具体值在feed_dict中的变量给出。
images_placeholder = tf.placeholder(tf.float32, shape=(batch_size, IMAGE_PIXELS))labels_placeholder = tf.placeholder(tf.int32, shape=(batch_size))#This is how you feed the training examples during the training:for step in xrange(FLAGS.max_steps): feed_dict = { images_placeholder: images_feed, labels_placeholder: labels_feed, } _, loss_value = sess.run([train_op, loss], feed_dict=feed_dict)
tf.Variable 主要用于定义weights bias等可训练会改变的变量,必须指定初始值。
weights = tf.Variable( tf.truncated_normal([IMAGE_PIXELS, hidden1_units], stddev=1.0 / math.sqrt(float(IMAGE_PIXELS))), name='weights')biases = tf.Variable(tf.zeros([hidden1_units]), name='biases')
阅读全文
0 0
- TF中的tf.Variable 和 tf.placehold 的区别
- TF中的tf.Variable 和 tf.placehold 的区别
- 【tensorflow 学习】tf.get_variable()和tf.Variable()的区别
- tensorflow的共享变量,tf.Variable(),tf.get_variable(),tf.Variable_scope(),tf.name_scope()联系与区别:
- tensorflow的共享变量,tf.Variable(),tf.get_variable(),tf.Variable_scope(),tf.name_scope()联系与区别
- tensorflow的共享变量,tf.Variable(),tf.get_variable(),tf.Variable_scope(),tf.name_scope()联系与区别
- tf.Variable()和tf.get_variable()的使用方法和相同点
- 【tensorflow】scope的使用以及tf.Variable()和tf.get_variable()的区别
- tf.Variable
- tf.Variable()
- tf.Variable()
- tf.Variable
- tf.name_scope&tf.variable scope
- TF
- tf
- tensorflow共享变量, tf.get_variable() 和 tf.Varibele()的区别
- tensorflow中tf.random_normal和tf.truncated_normal的区别
- TensorFlow函数:tf.Session()和tf.Session().as_default()的区别
- 第1章 C语言程序设计
- Java经典算法40例(三十五)
- Android开发 之 属性动画
- 单体内置对象,内置对象
- VScode使用技巧
- TF中的tf.Variable 和 tf.placehold 的区别
- 《剑指offer》和为s的连续正数序列
- 面试题
- 设计一个不能被继承的类
- 腾讯前端求职训练营第四天
- 汇编格式
- 最大公约数
- 蛇形填数
- ZooKeeper学习第三期---Zookeeper命令操作