how can I solve label shape problem in tensorflow when using one-hot encoding?
Since your data are already in a one-hot encoding, you can use tf.nn.softmax_cross_entropy_with_logits(), which expects an input of shape [batch_size, num_classes] for the labels.

(The tf.nn.sparse_softmax_cross_entropy_with_logits() op expects the labels as a batch of integers, where each integer corresponds to the class ID for each example.)