Python深度學(xué)習(xí)TensorFlow神經(jīng)網(wǎng)絡(luò)基礎(chǔ)概括
一、基礎(chǔ)理論
1、TensorFlow
tensor:張量(數(shù)據(jù))
flow:流動
Tensor-Flow:數(shù)據(jù)流

2、TensorFlow過程
TensorFlow構(gòu)成:圖和會話
1、構(gòu)建圖階段
構(gòu)建階段:定義了數(shù)據(jù)(張量tensor)與操作(節(jié)點operation),構(gòu)成圖(靜態(tài))
張量:TensorFlow中的基本數(shù)據(jù)對象。
節(jié)點:提供圖中執(zhí)行的操作。
2、執(zhí)行圖階段(會話)
執(zhí)行階段:使用會話執(zhí)行定義好的數(shù)據(jù)與操作。
二、TensorFlow實例(執(zhí)行加法)
1、構(gòu)造靜態(tài)圖
1-1、創(chuàng)建數(shù)據(jù)(張量)
#圖(靜態(tài)) a = tf.constant(2) #數(shù)據(jù)1(張量) b = tf.constant(6) #數(shù)據(jù)2(張量)
1-2、創(chuàng)建操作(節(jié)點)
c = a + b #操作(節(jié)點)
2、會話(執(zhí)行)
API:

普通執(zhí)行
#會話(執(zhí)行) with tf.Session() as sess: print(sess.run(a + b))

fetches(多參數(shù)執(zhí)行)
#會話(執(zhí)行) with tf.Session() as sess: print(sess.run([a,b,c]))

feed_dict(參數(shù)補充)
def Feed_Add():
#創(chuàng)建靜態(tài)圖
a = tf.placeholder(tf.float32)
b = tf.placeholder(tf.float32)
c = tf.add(a,b)
#會話(執(zhí)行)
with tf.Session() as sess:
print(sess.run(c, feed_dict={a:0.5, b:2.0}))

總代碼
import tensorflow as tf
def Add():
#圖(靜態(tài))
a = tf.constant(2) #數(shù)據(jù)1(張量)
b = tf.constant(6) #數(shù)據(jù)2(張量)
c = a + b #操作(節(jié)點)
#會話(執(zhí)行)
with tf.Session() as sess:
print(sess.run([a,b,c]))
def Feed_Add():
#創(chuàng)建靜態(tài)圖
a = tf.placeholder(tf.float32)
b = tf.placeholder(tf.float32)
c = tf.add(a,b)
#會話(執(zhí)行)
with tf.Session() as sess:
print(sess.run(c, feed_dict={a:0.5, b:2.0}))
Add()
Feed_Add()
以上就是Python深度學(xué)習(xí)TensorFlow神經(jīng)網(wǎng)絡(luò)基礎(chǔ)概括的詳細內(nèi)容,更多關(guān)于TensorFlow神經(jīng)網(wǎng)絡(luò)基礎(chǔ)的資料請關(guān)注本站其它相關(guān)文章!
版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非maisonbaluchon.cn所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。
關(guān)注官方微信