1. 程式人生 > >分析tensorflow mnist

分析tensorflow mnist

rmi oat string類型 padding net format _for 第一個 dimens

http://blog.csdn.net/mao_xiao_feng/article/details/53444333

第一個參數input:指需要做卷積的輸入圖像,它要求是一個Tensor,具有[batch, in_height, in_width, in_channels]這樣的shape,具體含義是[訓練時一個batch的圖片數量, 圖片高度, 圖片寬度, 圖像通道數],註意這是一個4維的Tensor,要求類型為float32和float64其中之一

第二個參數filter:相當於CNN中的卷積核,它要求是一個Tensor,具有[filter_height, filter_width, in_channels, out_channels]這樣的shape

,具體含義是[卷積核的高度,卷積核的寬度,圖像通道數,卷積核個數],要求類型與參數input相同,有一個地方需要註意,第三維in_channels,就是參數input的第四維

第三個參數strides:卷積時在圖像每一維的步長,這是一個一維的向量,長度4

第四個參數padding:string類型的量,只能是"SAME","VALID"其中之一,這個值決定了不同的卷積方式(後面會介紹)

第五個參數:use_cudnn_on_gpu:bool類型,是否使用cudnn加速,默認為true 我認為安裝tensorflow的時候選cpu和選gpu的區別就是這個true還是false

結果返回一個Tensor,這個輸出,就是我們常說的feature map

padding的值為‘VALID’不停留在邊緣,假設圖片5*5,卷積核3*3,則輸出3*3,當其為‘SAME’時,表示卷積核可以停留在圖像邊緣,輸出5*5

strides: A list of `ints`. 1-D tensor of length 4. The stride of the sliding window for each dimension of `input`. The dimension order is determined by the value of `data_format`, see below for details.你可以理解為[1,圖像heihgt上的滑動步長,圖像width上的滑動步長,1]前後兩個1,固定不變,沒有特殊意義

分析tensorflow mnist