import tensorflow as tf

#Fetch
input1 = tf.constant(1.0)
input2 = tf.constant(3.0)
input3 = tf.constant(5.0)

add = tf.add(input2,input3)
mul = tf.multiply(input1,add)

with tf.Session() as sess:
result = sess.run([mul,add])
print(result)

############输出   [8.0, 8.0]

#Feed
#创建占位符
input4 = tf.placeholder(tf.float32)
input5 = tf.placeholder(tf.float32)
output = tf.multiply(input4,input5)

with tf.Session() as sess:
#Feed的数据以字典的形式传入
print(sess.run(output,feed_dict={input4:[7.0],input5:[9.0]}))

#输出   [ 63.]

Tensorflow fetch和feed的更多相关文章

  1. tensorflow中的Fetch、Feed(02-3)

    import tensorflow as tf #Fetch概念 在session中同时运行多个op input1=tf.constant(3.0) #constant()是常量不用进行init初始化 ...

  2. Tensorflow学习教程------Fetch and Feed

    #coding:utf-8 import tensorflow as tf #Fetch input1 = tf.constant(3.0) input2 = tf.constant(1.0) inp ...

  3. tensorflow ValueError: Cannot feed value of shape (5000,) for Tensor 'output:0', which has shape '(?, 10)'

    提供的训练数据和定义的模型之间的维度不对应. 在MNIST手写数字识别时,在 mnist = input_data.read_data_sets("MNIST_data/") 中, ...

  4. 学习笔记TF066:TensorFlow移动端应用,iOS、Android系统实践

    TensorFlow对Android.iOS.树莓派都提供移动端支持. 移动端应用原理.移动端.嵌入式设备应用深度学习方式,一模型运行在云端服务器,向服务器发送请求,接收服务器响应:二在本地运行模型, ...

  5. tensorflow tfdbg 调试手段

    https://blog.csdn.net/gubenpeiyuan/article/details/82710163 TensorFlow 调试程序 tfdbg 是 TensorFlow 的专用调试 ...

  6. Tensorflow之基于MNIST手写识别的入门介绍

    Tensorflow是当下AI热潮下,最为受欢迎的开源框架.无论是从Github上的fork数量还是star数量,还是从支持的语音,开发资料,社区活跃度等多方面,他当之为superstar. 在前面介 ...

  7. 机器学习与Tensorflow(1)——机器学习基本概念、tensorflow实现简单线性回归

    一.机器学习基本概念 1.训练集和测试集 训练集(training set/data)/训练样例(training examples): 用来进行训练,也就是产生模型或者算法的数据集 测试集(test ...

  8. Tensorflow基本概念笔记

    一.TensorFlow使用简单,部署快捷 TensorFlow使用数据流图(计算图)来规划计算流程,可以将计算映射到不同的硬件和操作平台.凭借着统一的架构,TensorFlow可以方便的部署剑各种平 ...

  9. TensorFlow(二):基本概念以及练习

    一:基本概念 1.使用图(graphs)来表示计算任务 2.在被称之为会话(Session)的上下文(context)中执行图 3.使用tensor表示数据 4.通过变量(Variable)维护状态 ...

随机推荐

  1. C#中的线程(一)入门

    C#中的线程(一)入门   Keywords:C# 线程Source:http://www.albahari.com/threading/Author: Joe AlbahariTranslator: ...

  2. Codeforces Round #254(div2)A

    很有趣的题.想到了就非常简单,想不到就麻烦了. 其实就是一种逆向思维:最后结果肯定是这样子: WBWBWBWB... BWBWBWBW... WBWBWBWB... ... 里面有“-”的地方改成“- ...

  3. grep搜索子目录中包含某字符串的特定文件

    grep -n "str" -r ./ 这是查找当前目录下以及下辖子目录下所有包含str字符串的文件,会列出文件名.以及该行的内容.以及行号 比如,我想搜源码目录src下,包含“n ...

  4. tensorflow中创建多个计算图(Graph)

    tf程序中,系统会自动创建并维护一个默认的计算图,计算图可以理解为神经网络(Neural Network)结构的程序化描述.如果不显式指定所归属的计算图,则所有的tensor和Operation都是在 ...

  5. pip镜像源

    pip是用国内镜像源 https://pypi.python.org/http://pypi.douban.com/simple/ http://mirrors.aliyun.com/pypi/sim ...

  6. NOIP模拟题 栅栏

    题目大意 给定一个$n\times m$的网格图,每次会选择一块矩形沿着网格线铺上栅栏,或者拆除之前铺的栅栏,或者询问两个格子能否不经过栅栏直接到达. 保证栅栏没有重叠或交叉,删去的栅栏删除前一定存在 ...

  7. Python之用虚拟环境隔离项目,并重建依赖关系

    下面将以安装django和mysqlclient介绍如何用虚拟环境隔离项目,并重建依赖关系.操作系统:windows 10:python版本:python3.7 1. 安装python虚拟环境 (1) ...

  8. 461. Hamming Distance Add to List

    // 快速法求1的个数 int BitCount2(unsigned int n) { unsigned ; ; n; ++c) { n &= (n -) ; // 清除最低位的1 } ret ...

  9. Docker-安装与部署

    本文在CentsOS下安装Docker 1.安装前准备工作 系统要求: 在CentOS下需要64位的CentsOS 7  OS requirements To install Docker, you ...

  10. Oracle job procedure 存储过程定时任务(转自hoojo)

    Oracle job procedure 存储过程定时任务 oracle job有定时执行的功能,可以在指定的时间点或每天的某个时间点自行执行任务. 一.查询系统中的job,可以查询视图 --相关视图 ...