import tensorflow as tf

    '''因为rnn_outputs是三维的，这里需要将其转成2维的，
       矩阵运算后再转换回来[batch_size, num_steps, num_classes]'''
logits = tf.reshape(tf.matmul(tf.reshape(rnn_outputs, [-1, state_size]), W) +b, \
                    shape=[batch_size, num_steps, num_classes])
predictions = tf.nn.softmax(logits)

y_as_list = tf.unstack(y, num=num_steps, axis=1)
losses = tf.nn.sparse_softmax_cross_entropy_with_logits(labels=y,logits=logits)
