本文是在使用tensorflow進(jìn)行開(kāi)發(fā)的過(guò)程中學(xué)習(xí)到的一些技巧的總結(jié)
1.gfile
??Tensorflow中使用gfile 可以無(wú)鎖的讀取文件.
2.*list
??zip wants a bunch of arguments to zip together, but what you have is a single argument (a list, whose elements are also lists). The * in a function call "unpacks" a list (or other iterable), making each of its elements a separate argument. So without the *, you're doing zip( [[1,2,3],[4,5,6]] ). With the *, you're doing zip([1,2,3], [4,5,6]).
3. couter.items()
??this function returns a list with tuples as its elements
4 list(tuple)
??returns 2 lists surprisingly with all 1st elems as 1st list and 2nd elems as 2nd list
5 tf.identiy的意義
??主要參考的是這篇博客.簡(jiǎn)單來(lái)說(shuō),identity 和control_dependencies這兩個(gè)方法始終是同時(shí)使用的凤价,我們想要獲得identy的返回值代表的tensor值,但是必須得在執(zhí)行完control_dependencies 方法之后猜獲戎吭.
??對(duì)我而言,這個(gè)部分的理解的難點(diǎn)在于赞庶,y=x和y=tf.identity(x)的區(qū)別.前者是給變量x起了個(gè)別名训挡,后者是復(fù)制出來(lái)一個(gè)新的變量.
6. control_dependencies
??這個(gè)函數(shù)是一個(gè)依賴管理器,當(dāng)輸入?yún)?shù)和內(nèi)容都是op的時(shí)候歧强,必須先把輸入?yún)?shù)中的op執(zhí)行了澜薄,才能執(zhí)行內(nèi)容中的op
7.數(shù)據(jù)輸入
??根據(jù)官方的教程,我們能夠發(fā)現(xiàn)有至少三種輸入方式.本文在這里僅僅介紹比較復(fù)雜的文本輸入和隊(duì)列輸入機(jī)制.
8.range_input_producer
??這玩意是隊(duì)列的一種摊册,而隊(duì)列是tensorflow的輸入中最重要的一環(huán).需要注意肤京,所有對(duì)隊(duì)列有依賴的操作,每次dequeue都會(huì)得到新的數(shù).實(shí)現(xiàn)的機(jī)制茅特,其實(shí)就是最基本的那一句話.每一個(gè)操作的eval都會(huì)把所有的依賴操作eval
9.flags
??主要用于在命令行啟動(dòng)程序時(shí)傳遞參數(shù)