title: Tensorflow: dynamic_rnn under specific gpu device can't work, no supported kernel for GPU devices is available
body: <p>I want to use dynamic_rnn under specific gpu device, but it raises errors as below:</p>
  
  <pre><code>import tensorflow as tf
  
  sequence = [[1, 2],[2, 3, 5]]
  def generator():
      for el in sequence:
          yield el
  
  dataset = tf.data.Dataset().from_generator(generator, tf.int32, tf.TensorShape([None]))
  dataset = dataset.map(lambda seq: (seq, tf.size(seq)))
  dataset = dataset.padded_batch(1, padded_shapes=(tf.TensorShape([None]), tf.TensorShape([])), padding_values=(0, 0))
  iter = dataset.make_initializable_iterator()
  seq, seq_len = iter.get_next()
  
  embedding = tf.get_variable('embeddings', [10, 100])
  cells = tf.contrib.rnn.GRUCell(5)
  emb = tf.nn.embedding_lookup(embedding, seq)
  
  with tf.device('/gpu:0'):  # If I assign the gpu device, the codes below will raise errors
      outputs, state = tf.nn.dynamic_rnn(cell=cells, inputs=emb, sequence_length=seq_len, dtype=tf.float32)
  
  with tf.Session() as sess:
      sess.run(iter.initializer)
  
      sess.run(tf.global_variables_initializer())
      out = sess.run(outputs)
  </code></pre>
  
  <p>Errors:</p>
  
  <pre><code>Caused by op 'rnn/Assert/Assert', defined at:
    File "test.py", line 22, in &lt;module&gt;
      outputs, state = tf.nn.dynamic_rnn(cell=cells, inputs=emb, sequence_length=seq_len, dtype=tf.float32)
    File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/rnn.py", line 622, in dynamic_rnn
      [_assert_has_shape(sequence_length, [batch_size])]):
    File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/rnn.py", line 617, in _assert_has_shape
      packed_shape, " but saw shape: ", x_shape])
    File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/tf_should_use.py", line 118, in wrapped
      return _add_should_use_warning(fn(*args, **kwargs))
    File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 172, in Assert
      return gen_logging_ops._assert(condition, data, summarize, name="Assert")
    File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gen_logging_ops.py", line 51, in _assert
      name=name)
    File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
      op_def=op_def)
    File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 3290, in create_op
      op_def=op_def)
    File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 1654, in __init__
      self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access
  
  InvalidArgumentError (see above for traceback): Cannot assign a device for operation 'rnn/Assert/Assert': Could not satisfy explicit device specification '/device:GPU:0' because no supported kernel for GPU devices is available.
  Registered kernels:
    device='CPU'
  
       [[Node: rnn/Assert/Assert = Assert[T=[DT_STRING, DT_INT32, DT_STRING, DT_INT32], summarize=3, _device="/device:GPU:0"](rnn/All, rnn/Assert/Assert/data_0, rnn/stack, rnn/Assert/Assert/data_2, rnn/Shape_1)]]
  </code></pre>
  
  <p>If I don't use tf.device('/gpu:0'), then the codes can work well.
  But for some reason I need to use it, e.g. multi-gpu support.
  How should I resolve it? Thanks</p>