title: sparse_softmax_cross_entropy_with_logits results is worse than softmax_cross_entropy_with_logits
body: <p>I implement classic image classification problem with tensorflow, I have 9 classes, first I use <code>softmax_cross_entropy_with_logits</code> as classifier and train network, after some steps it gives to about 99% train accuracy,</p>
  
  <p>Then test the same problem with <code>sparse_softmax_cross_entropy_with_logits</code> this time it doesn't converge at all,(train accuracy is around 0.10 and 0.20)</p>
  
  <p>Only for your information, for <code>softmax_cross_entropy_with_logits</code>, I use [batch_size, num_classes] with dtype float32 for labels, and for <code>sparse_softmax_cross_entropy_with_logits</code> I use [batch_size] with dtype int32 for labels. </p>
  
  <p>Does anybody have any idea? </p>
  
  <p><strong>Update:</strong></p>
  
  <pre><code>this is code:
  
  def costFun(self):  
      self.y_ = tf.reshape(self.y_, [-1]) 
      return tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(self.score_, self.y_))
  
  def updateFun(self):
      return tf.train.AdamOptimizer(learning_rate = self.lr_).minimize(self.cost_)
  
  def perfFun(self):
      correct_pred = tf.equal(tf.argmax(self.score_,1), tf.argmax(y,1))
      return(tf.reduce_mean(tf.cast(correct_pred, tf.float32)))
  
  def __init__(self,x,y,lr,lyr1FilterNo,lyr2FilterNo,lyr3FilterNo,fcHidLyrSize,inLyrSize,outLyrSize, keepProb):
  
      self.x_            = x
      self.y_            = y
      self.lr_           = lr
      self.inLyrSize     = inLyrSize
      self.outLyrSize_   = outLyrSize
      self.lyr1FilterNo_ = lyr1FilterNo
      self.lyr2FilterNo_ = lyr2FilterNo
      self.lyr3FilterNo_ = lyr3FilterNo
      self.fcHidLyrSize_ = fcHidLyrSize
      self.keepProb_     = keepProb
  
      [self.params_w_, self.params_b_] = ConvNet.paramsFun(self) 
      self.score_, self.PackShow_      = ConvNet.scoreFun (self) 
      self.cost_                       = ConvNet.costFun  (self) 
      self.update_                     = ConvNet.updateFun(self) 
      self.perf_                       = ConvNet.perfFun  (self) 
  </code></pre>
  
  <p>main:</p>
  
  <pre><code>lyr1FilterNo = 32 
  lyr2FilterNo = 64 
  lyr3FilterNo = 128 
  
  fcHidLyrSize = 1024
  inLyrSize    = 32 * 32 
  
  outLyrSize   = 9
  lr           = 0.001
  batch_size   = 300
  
  dropout      = 0.5
  x            = tf.placeholder(tf.float32, [None, inLyrSize ])
  y            = tf.placeholder(tf.int32,    None             ) 
  
  ConvNet_class = ConvNet(x,y,lr,lyr1FilterNo,lyr2FilterNo,lyr3FilterNo,fcHidLyrSize,inLyrSize,outLyrSize, keepProb)
  initVar = tf.global_variables_initializer()
  
  
  with tf.Session() as sess:
      sess.run(initVar)   
  
      for step in range(10000): 
  
          trData_i  = np.reshape( trData_i , ( -1, 32 * 32 ) ) 
          trLabel_i = np.reshape( trLabel_i, ( -1, 1       ) )  
  
          update_i, PackShow, wLyr1_i, wLyr2_i, wLyr3_i = sess.run([ConvNet_class.update_, ConvNet_class.PackShow_,
                              ConvNet_class.params_w_['wLyr1'], ConvNet_class.params_w_['wLyr2'], ConvNet_class.params_w_['wLyr3']], 
                              feed_dict = { x:trData_i, y:trLabel_i, keepProb:dropout} )
  </code></pre>