Guest User

Untitled

a guest
Sep 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. with tf.device(gpu[0]):
  2. print("Using GPU: {}".format(gpu[0]))
  3. a = tf.random_normal([2000, 5000])
  4. b = tf.random_normal([5000, 1000])
  5. res1 = tf.matmul(a, b)
  6.  
  7. with tf.device(gpu[1]):
  8. print("Using GPU: {}".format(gpu[1]))
  9. a = tf.random_normal([2000, 5000])
  10. b = tf.random_normal([5000, 1000])
  11. res2 = tf.matmul(a, b)
  12.  
  13. sum_res = None
  14. with tf.device(cpu[0]):
  15. print("Using CPU: {}".format(cpu[0]))
  16. sum_res = tf.add(res1, res2)
Add Comment
Please, Sign In to add comment