Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. > lstm_cell = tf.contrib.rnn.BasicLSTMCell(self.cell_size,
  2. > forget_bias=1.0, state_is_tuple=True)
  3. > with tf.name_scope('initial_state'):
  4. > self.cell_init_state = lstm_cell.zero_state(self.batch_size, dtype=tf.float32)
  5. > self.cell_outputs, self.cell_final_state = tf.nn.dynamic_rnn( lstm_cell, self.l_in_y, initial_state=self.cell_init_state,
  6. > time_major=False)
  7.  
  8. self.cell = tf.contrib.rnn.LSTMCell(self.cell_size)
  9. self.attention_mechanism = tf.contrib.seq2seq.BahdanauMonotonicAttention(self.cell_size, self.l_in_y)
  10. with tf.name_scope('audiowarpper'):
  11. self.attn_cell = tf.contrib.seq2seq.AttentionWrapper(self.cell, self.attention_mechanism, self.cell_size, alignment_history=True, output_attention= True)
  12. with tf.name_scope('initial_state'):
  13. self.cell_init_state = self.attn_cell.zero_state(self.batch_size, dtype=tf.float32)
  14. self.cell_outputs, self.cell_final_state = tf.nn.dynamic_rnn(
  15. self.attn_cell, self.l_in_y, initial_state=self.cell_init_state, dtype=tf.float32, time_major=False)
  16.  
  17. Traceback (most recent call last):
  18. File "/home/wentao/Desktop/wochenende/rnn_weight/rnn2.py", line 178, in <module>
  19. [model.train_op, model.cost, model.cell_final_state, model.pred],feed_dict=model.feed_dict)
  20. File "/home/wentao/PycharmProjects/LAS/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 929, in run
  21. run_metadata_ptr)
  22. File "/home/wentao/PycharmProjects/LAS/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1137, in _run
  23. self._graph, fetches, feed_dict_tensor, feed_handles=feed_handles)
  24. File "/home/wentao/PycharmProjects/LAS/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 471, in __init__
  25. self._fetch_mapper = _FetchMapper.for_fetch(fetches)
  26. File "/home/wentao/PycharmProjects/LAS/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 261, in for_fetch
  27. return _ListFetchMapper(fetch)
  28. File "/home/wentao/PycharmProjects/LAS/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 370, in __init__
  29. self._mappers = [_FetchMapper.for_fetch(fetch) for fetch in fetches]
  30. File "/home/wentao/PycharmProjects/LAS/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 261, in for_fetch
  31. return _ListFetchMapper(fetch)
  32. File "/home/wentao/PycharmProjects/LAS/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 370, in __init__
  33. self._mappers = [_FetchMapper.for_fetch(fetch) for fetch in fetches]
  34. File "/home/wentao/PycharmProjects/LAS/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 271, in for_fetch
  35. return _ElementFetchMapper(fetches, contraction_fn)
  36. File "/home/wentao/PycharmProjects/LAS/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 304, in __init__
  37. (fetch, type(fetch), str(e)))
  38. TypeError: Fetch argument <tensorflow.python.ops.tensor_array_ops.TensorArray object at 0x7f11249b8e10> has invalid type <class 'tensorflow.python.ops.tensor_array_ops.TensorArray'>, must be a string or Tensor. (Can not convert a TensorArray into a Tensor or Operation.)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement