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三通道.于是我们需要对这张大图片切分成一个个的小 ...
随机推荐
- Centos 8双网卡设置
原理:不管开发板是通过直连.路由器还是交换机连接到PC机,最终都是接到PC的以太网网卡(对笔记本来说,一般存在两个网卡,一个WIFI网卡和以太网网卡):因此要实现PC机与虚拟机的互ping,必须把虚拟 ...
- P1044 火星数字
P1044 火星数字 转跳点:
- 自动填充IP地址
在windows下的DOS窗口中 要利用Netsh命令,进入到DOS下的网络配置状态,就能实现各种网络配置. 进入IP设置模式 在DOS环境中,设置网络参数之前,必须先进入IP设置模式才可以.先打开系 ...
- Django——include()三种使用方法
include()的三种使用方法 1.include(module, namespace=None) 2.include(pattern_list) 最常用 3.include((pattern_l ...
- 干货分享:Research Essay写作规范详解
同学们在刚到国外时觉得一切都很新鲜,感觉到处都在吸引着他们,但是大部分留学生在刚碰到Research Essay便是一头包.其实Research Essay也没有想象中的那么难,只是留学生们初次接触, ...
- 三、jsx简化教程
1)使用 JSX 的好处 1.提供更加语意化且易懂的标签 与html对比 <!--HTML写法--> <form class="messageBox"> & ...
- Day1-T1
原题目 Describe:普通前缀和(当然有升级版的题目,范围3000+) code: #include<bits/stdc++.h> #define maxn 1010 #define ...
- h5-伸缩布局
1.html代码 <div class="box"> <div class="first">1</div> <div ...
- RecyclerView+FloatingActionButton应用
一.效果图 二.实现步骤 1.XML布局-添加依赖 <LinearLayout android:id="@+id/layout" android:layout_width=& ...
- CocoaPods安装/卸载/初始化等常用操作
CocoaPods的官网:https://cocoapods.org/,官方指导文档https://guides.cocoapods.org/ 1)ruby gem源更换国内源gems.ruby-ch ...