Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def return_array(tensor_obj):
- with tf.Session() as ses:
- coord = tf.train.Coordinator()
- threads = tf.train.start_queue_runners(coord=coord)
- array = ses.run(tensor_obj)
- coord.request_stop()
- coord.join(threads)
- return tf.constant(array)
- param = tf.constant([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])
- tensor_ob = tf.placeholder(tf.int32, shape = (10, 1))
- parameter = return_array(tensor_ob)
- init = tf.global_variables_initializer()
- with tf.Session() as sess:
- coord = tf.train.Coordinator()
- threads = tf.train.start_queue_runners(coord=coord)
- sess.run(init)
- print(sess.run(parameter, feed_dict={tensor_ob : param}))
- coord.request_stop()
- coord.join(threads)
Add Comment
Please, Sign In to add comment