TF中的tf.Variable 和 tf.placehold 的区别
2017-07-16 13:30
148 查看
参考自: https://stackoverflow.com/questions/36693740/whats-the-difference-between-tf-placeholder-and-tf-variable
tf.placehold 占位符。 主要为真实输入数据和输出标签的输入, 用于在 feed_dict中的变量,不需要指定初始值,具体值在feed_dict中的变量给出。
tf.Variable 主要用于定义weights bias等可训练会改变的变量,必须指定初始值。
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')
相关文章推荐
- TF中的tf.Variable 和 tf.placehold 的区别
- tf.name_scope() 与 tf.variable_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()联系与区别
- 【tensorflow 学习】tf.get_variable()和tf.Variable()的区别
- 【tensorflow】scope的使用以及tf.Variable()和tf.get_variable()的区别
- tf.variable和tf.get_Variable以及tf.name_scope和tf.variable_scope的区别
- tensorflow共享变量, tf.get_variable() 和 tf.Varibele()的区别
- tf.variable_scope()和tf.name_scope()函数的区别
- tensorflow之tf.placeholder 与 tf.Variable区别对比
- tensorflow的共享变量,tf.Variable(),tf.get_variable(),tf.Variable_scope(),tf.name_scope()联系与区别:
- tensorflow中tf.Variable() 方法和 tf.get_variable()方法的区别
- @PathVariable和@RequestParam的区别
- @RequestParam与@PathVariable的区别
- Oracle 10g 与 11g 绑定变量(Bind Variable) 区别 说明
- @RequestParam和@PathVariable的区别(学习笔记)
- Java 子类父类继承Method和Variable的区别
- @RequestParam与@PathVariable的区别
- @PathVariable和@RequestParam的区别,@SessionAttributes
- spring 注解@PathVariable和@RequestParam的区别