美文网首页
tensorflow实战-3.placeholder

tensorflow实战-3.placeholder

作者: 科幻不再未来 | 来源:发表于2016-10-17 20:16 被阅读0次
#coding=utf-8


import tensorflow as tf

#申明一个placeholder,理解为占位,shape可以填充时定,也可以事先定,run的时候填充数据
input1 = tf.placeholder(tf.float32)
input2 = tf.placeholder(tf.float32)
output = tf.mul(input1, input2)

with tf.Session() as sess:
  print(sess.run([output], feed_dict={input1:[7.], input2:[2.]}))
  
# output:
# [array([ 14.], dtype=float32)]

相关文章

网友评论

      本文标题:tensorflow实战-3.placeholder

      本文链接:https://www.haomeiwen.com/subject/wrxzyttx.html