zoukankan      html  css  js  c++  java
  • TensorFlow——小练习:feed

    feed就是喂入数据

    使用feed前必须要有占位符作为操作的对象,在运行操作的时候喂入数据。

     1 # _*_coding:utf-8_*_
     2 import tensorflow as tf
     3 import numpy as np
     4 
     5 input1 = tf.placeholder(tf.float32)    # 占位符要指明元素数据类型,在运行操作时,若算子有占位符,需要在运行时,通过feed_dict来指feed的数据
     6 input2 = tf.placeholder(tf.float32)
     7 
     8 output = tf.mul(input1, input2)
     9 
    10 with tf.Session() as sess:
    11     print(sess.run(output, feed_dict={input1:[7.0], input2:[2.]}))

     运行结果:

    [ 14.]
  • 相关阅读:
    20171121
    20171117
    20171106
    20171031
    20171024
    20170924
    20170721
    商品的分类
    会员价格的修改
    会员价格删除
  • 原文地址:https://www.cnblogs.com/DianeSoHungry/p/7144751.html
Copyright © 2011-2022 走看看