softmax_cross_entropy_with_logits:
首先看輸入logits,它的shape是[batch_size, num_classes] ,一般來講,就是神經(jīng)網(wǎng)絡最后一層的輸入z
另外一個輸入是labels,它的shape也“應該是“”[batch_size, num_classes],就是我們神經(jīng)網(wǎng)絡期望的輸出。
sparse_softmax_cross_entropy_with_logits
放寬了限制,labels參數(shù)只要是[batch_size]就可以,這樣的話就是shape=(batch_size,)是[1,batch_size]的一維數(shù)組就行了,函數(shù)內(nèi)部會轉換以及one_hot來實現(xiàn)softmax_cross_entropy_with_logits計算