Guest User

Untitled

a guest
Dec 10th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. def return_array(tensor_obj):
  2. with tf.Session() as ses:
  3. coord = tf.train.Coordinator()
  4. threads = tf.train.start_queue_runners(coord=coord)
  5. array = ses.run(tensor_obj)
  6. coord.request_stop()
  7. coord.join(threads)
  8. return tf.constant(array)
  9.  
  10. param = tf.constant([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])
  11. tensor_ob = tf.placeholder(tf.int32, shape = (10, 1))
  12. parameter = return_array(tensor_ob)
  13. init = tf.global_variables_initializer()
  14. with tf.Session() as sess:
  15. coord = tf.train.Coordinator()
  16. threads = tf.train.start_queue_runners(coord=coord)
  17. sess.run(init)
  18. print(sess.run(parameter, feed_dict={tensor_ob : param}))
  19. coord.request_stop()
  20. coord.join(threads)
Add Comment
Please, Sign In to add comment