Tensorflow基础笔记
1、Keras是一个由Python编写的开源人工神经网络库。
2、深度学习主要应用在三个大的方向,计算机视觉,自然语言处理,强化学习
3、计算机视觉主要有:图片识别,目标检测,语义分割,视频理解(行为检测),
图片生成,艺术风格迁移等等。
4、自然语言处理:机器翻译、聊天机器人
5、强化学习:虚拟游戏、机器人、自动驾驶
6、tensorflow:加速计算,自动梯度,
常用神经网络接口:
9、另外还有一个tf.truncated_normal()函数,它创建了一个包含从截断的正态分布中随机抽取的值的张量,其中下上限是标准偏差的两倍。
10、图和会话:所有不同的变量以及对这些变量的操作都保存在图(Graph)中。在构建了一个包含针对模型的所有计算步骤的图之后,就可以在会话(Session)中运行这个图了。会话可以跨CPU和GPU分配所有的计算。
graph = tf.Graph()
with graph.as_default():
a=tf.Variable(8,tf.float32)
b=tf.Variable(tf.zeros[2,2],tf.float32) with tf.Session(graph=graph) as session:
tf.global_variables_initializer().run()
print(f)
print(session.run(f))
print(session.run(k))
结果:
<tf.Variable 'Variable:0' shape=() dtype=int32_ref> #print (a)
8
[[0. 0.]
[0. 0.]]
在tensorflow中我们在执行session之前需要设置占位符,在session.run中用feed_dict 将其传入
tensorflow中的占位符用 tf.placeholder并且有三个参数
(1)数据类型:
(2)数据大小:
(3)占位符名称:
例如:
import tensorflow as tf
import numpy as np x = tf.placeholder(tf.float32, [2, 50], name = 'originalx')
y = tf.placeholder(tf.float32, [2,50], name = 'originaly') c = x+y with tf.Session() as sess:
a = np.random.randint(0,80,100).reshape((2,50))
aa = np.random.random(100).reshape((2,50))
result = sess.run(c, feed_dict = {x:a, y:aa})
print(result)
Tensorflow基础笔记的更多相关文章
- TensorFlow基础笔记(0) 参考资源学习文档
1 官方文档 https://www.tensorflow.org/api_docs/ 2 极客学院中文文档 http://www.tensorfly.cn/tfdoc/api_docs/python ...
- TensorFlow基础笔记(3) cifar10 分类学习
TensorFlow基础笔记(3) cifar10 分类学习 CIFAR-10 is a common benchmark in machine learning for image recognit ...
- TensorFlow基础笔记(15) 编译TensorFlow.so,提供给C++平台调用
参考 http://blog.csdn.net/rockingdingo/article/details/75452711 https://www.cnblogs.com/hrlnw/p/700764 ...
- TensorFlow基础笔记(0) tensorflow的基本数据类型操作
import numpy as np import tensorflow as tf #build a graph print("build a graph") #生产变量tens ...
- TensorFlow基础笔记(14) 网络模型的保存与恢复_mnist数据实例
http://blog.csdn.net/huachao1001/article/details/78502910 http://blog.csdn.net/u014432647/article/de ...
- TensorFlow基础笔记(13) tf.name_scope tf.variable_scope学习
转载http://blog.csdn.net/jerr__y/article/details/60877873 1. 首先看看比较简单的 tf.name_scope(‘scope_name’). tf ...
- TensorFlow基础笔记(13) Mobilenet训练测试mnist数据
主要是四个文件 mnist_train.py #coding: utf-8 import os import tensorflow as tf from tensorflow.examples.tut ...
- TensorFlow基础笔记(11) conv2D函数
#链接:http://www.jianshu.com/p/a70c1d931395 import tensorflow as tf import tensorflow.contrib.slim as ...
- TensorFlow基础笔记(9) Tensorboard可视化显示以及查看pb meta模型文件的方法
参考: http://blog.csdn.net/l18930738887/article/details/55000008 http://www.jianshu.com/p/19bb60b52dad ...
- TensorFlow基础笔记(8) TensorFlow简单人脸识别
数据材料 这是一个小型的人脸数据库,一共有40个人,每个人有10张照片作为样本数据.这些图片都是黑白照片,意味着这些图片都只有灰度0-255,没有rgb三通道.于是我们需要对这张大图片切分成一个个的小 ...
随机推荐
- poj 2456 Aggressive cows 贪心+二分
Aggressive cows Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 25944 Accepted: 11982 ...
- .NET via C#笔记12——泛型
12 泛型 使用值类型作为参数的泛型容器,传入值类型的参数时,不需要进行装箱 12.1 FCL中的泛型 System.Array中提供了很多泛型方法 AsReadOnly BinarySearch C ...
- 网卡工作原理和wireshark混杂模式
通过设置网卡为混杂模式就能捕获局域网内所有发包内容,包括非广播包和非发给自己主机的数据包 这是为什么呢? 即主机A发送一个数据包给主机B,我作为主机C怎么也能截获这个数据包呢,原理是什么? 我的网卡为 ...
- GLConsole的编译和使用
1.在CVars文件中搜索tinyxml,去掉所有tinyxml的编译选项 2.Add the following line to the "CMakeLists.txt" fil ...
- css选择器权重、样式继承、默认样式
学过css的小伙伴都是指css选择器的权重 !important Infinity 行间样式 1000 id 100 class|属性|伪类 10 标签|伪元素 1 通配符 0 权重相同 相同cs ...
- 089-PHP数组运用 - 通过循环函数取出部分成员合并成新数组
<?php function myfunc($arr){ //定义过滤函数 $j=count($arr); for($i=0;$i<$j;$i++){ if($arr[$i]>=0& ...
- 学术Essay写作如何体现逻辑的应用
作为一篇学术essay,逻辑要求是必不可少的.那么,学术essay如何写作才能体现逻辑呢?这就需要从语言逻辑和科学逻辑出发. 语言逻辑指的是三C原则:(1)complete(完整),(2)concis ...
- [ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: URLError: <urlopen error [Errno 10061] Connection refused>
[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: URLError: <urlopen error ...
- POJ 1423:Big Number 求N的阶乘的长度 斯特林公式
Big Number Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 27027 Accepted: 8626 Descr ...
- cf 525D.Arthur and Walls
判断2*2的正方形,是不是3个"."1个"*"然后暴力bfs就好.(这种处理也是挺神奇的2333%%题解) #include<bits/stdc++.h& ...