Python深度学习TensorFlow神经网络基础概括
作者:_睿智_ 时间:2022-08-13 02:57:18
一、基础理论
1、TensorFlow
tensor
:张量(数据)
flow
:流动
Tensor-Flow
:数据流
2、TensorFlow过程
TensorFlow构成:图和会话
1、构建图阶段
构建阶段:定义了数据(张量tensor)与操作(节点operation),构成图(静态)
张量:TensorFlow中的基本数据对象。
节点:提供图中执行的操作。
2、执行图阶段(会话)
执行阶段:使用会话执行定义好的数据与操作。
二、TensorFlow实例(执行加法)
1、构造静态图
1-1、创建数据(张量)
#图(静态)
a = tf.constant(2) #数据1(张量)
b = tf.constant(6) #数据2(张量)
1-2、创建操作(节点)
c = a + b #操作(节点)
2、会话(执行)
API:
普通执行
#会话(执行)
with tf.Session() as sess:
print(sess.run(a + b))
fetches(多参数执行)
#会话(执行)
with tf.Session() as sess:
print(sess.run([a,b,c]))
feed_dict(参数补充)
def Feed_Add():
#创建静态图
a = tf.placeholder(tf.float32)
b = tf.placeholder(tf.float32)
c = tf.add(a,b)
#会话(执行)
with tf.Session() as sess:
print(sess.run(c, feed_dict={a:0.5, b:2.0}))
总代码
import tensorflow as tf
def Add():
#图(静态)
a = tf.constant(2) #数据1(张量)
b = tf.constant(6) #数据2(张量)
c = a + b #操作(节点)
#会话(执行)
with tf.Session() as sess:
print(sess.run([a,b,c]))
def Feed_Add():
#创建静态图
a = tf.placeholder(tf.float32)
b = tf.placeholder(tf.float32)
c = tf.add(a,b)
#会话(执行)
with tf.Session() as sess:
print(sess.run(c, feed_dict={a:0.5, b:2.0}))
Add()
Feed_Add()
来源:https://blog.csdn.net/great_yzl/article/details/120479152
标签:Python,深度学习,TensorFlow,神经网络
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
浅谈python正则的常用方法 覆盖范围70%以上
2022-05-18 21:01:13
![](https://img.aspxhome.com/file/2023/4/77034_0s.png)
好的产品设计并非始于图片,而是对人的理解
2009-08-02 20:25:00
python3中set(集合)的语法总结分享
2022-06-06 21:44:56
全网首秀之Pycharm十大实用技巧(推荐)
2023-08-09 16:11:00
![](https://img.aspxhome.com/file/2023/9/63259_0s.png)
asp.net(c#)实现从sqlserver存取二进制图片的代码
2023-06-26 21:48:03
解决python删除文件的权限错误问题
2023-09-06 07:33:36
代码总结Python2 和 Python3 字符串的区别
2023-05-25 00:58:52
Python抓取电影天堂电影信息的代码
2023-07-23 17:18:49
PHP PDOStatement::errorCode讲解
2023-06-11 12:40:23
兼容低版本 IE 的 JScript 5.5 实现
2008-07-01 12:48:00
将mysql转换到oracle必须了解的50件事
2010-07-05 12:15:00
python实现三壶谜题的示例详解
2021-12-09 19:56:15
![](https://img.aspxhome.com/file/2023/1/113001_0s.png)
Tensorflow加载Vgg预训练模型操作
2023-10-13 10:56:23
![](https://img.aspxhome.com/file/2023/5/80795_0s.jpg)
python3.4中清屏的处理方法
2023-11-14 04:09:21
![](https://img.aspxhome.com/file/2023/3/64603_0s.jpg)
python去除扩展名的实例讲解
2022-05-08 18:10:49
oracle 日期函数集合(集中版本)第1/2页
2009-06-19 17:23:00
pandas使用之宽表变窄表的实现
2022-04-21 06:04:02
![](https://img.aspxhome.com/file/2023/2/99702_0s.jpg)
Django中间件实现拦截器的方法
2022-10-21 04:47:53
![](https://img.aspxhome.com/file/2023/9/85149_0s.jpg)
asp 取一个数的整数 但不是四舍五入,只要有小数,就取大于这个数的整数
2011-03-17 10:34:00
python实现根据月份和日期得到星座的方法
2023-02-02 01:05:51