title: GRU in Tensorflow 1.3
body: <p>I want to implement a GRU for sentiment analysis and this is what I have so far:</p>
  <pre><code>epochs = 20
  batch_size = 25
  embedding_size = 50
  layers = 1
  max_label = 2  # only valid target labels are 0 and 1
  
  # one word is fed in at any time instance
  embedding_matrix = tf.Variable(tf.random_uniform([vocabulary_size, embedding_size], -1.0, 1.0))
  embeddings = tf.nn.embedding_lookup(embedding_matrix, x)
  
  # number of neurons in a single LSTM cell is equal to the embedding size
  cell = tf.contrib.rnn.GRUCell(embedding_size)
  cell = tf.contrib.rnn.DropoutWrapper(cell=cell, output_keep_prob=0.75)
  
  # encoding fed into softmax prediction layer
  output, states = tf.nn.dynamic_rnn(cell, embeddings, dtype=tf.float32)
  
  logits = tf.layers.dense(output, max_label, activation=None)
  
  cross_entropy = tf.nn.sparse_softmax_cross_entropy_with_logits(logits=logits, labels=y)
  loss = tf.reduce_mean(cross_entropy)
  
  # prediction is accurate if predicted label is equal to the actual label
  prediction = tf.equal(tf.argmax(logits, 1), tf.cast(y, tf.int64))
  
  accuracy = tf.reduce_mean(tf.cast(prediction, tf.float32))
  </code></pre>
  <p>But I get this error:</p>
  <pre><code>ValueError: Rank mismatch: Rank of labels (received 1) should equal rank of logits minus 1 (received 3).
  </code></pre>
  <p>I tried changing the value of max_label to 2 and 1 and tried to make logits=logits-1 but the error is still there. How can I fix it?</p>