Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. test = [hey how you doing?, did you eat? , how was your day?, the car looks so new, the bike is mine,......]
  2.  
  3. tf.logging.set_verbosity(tf.logging.ERROR)
  4. with tf.Session() as session:
  5. session.run([tf.global_variables_initializer(),
  6. tf.tables_initializer()])
  7. message_embeddings = session.run(embed(test))
  8.  
  9. import multiprocessing as mp
  10. pool = mp.Pool(mp.cpu_count())
  11.  
  12. def embed(row):
  13. tf.logging.set_verbosity(tf.logging.ERROR)
  14. with tf.Session() as session:
  15. session.run([tf.global_variables_initializer(),
  16. tf.tables_initializer()])
  17. message_embeddings = session.run(embed(row))
  18. return(message_embeddings)
  19.  
  20. result = pool.map(embed, [row for row in test])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement