Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with tf.device(gpu[0]):
- print("Using GPU: {}".format(gpu[0]))
- a = tf.random_normal([2000, 5000])
- b = tf.random_normal([5000, 1000])
- res1 = tf.matmul(a, b)
- with tf.device(gpu[1]):
- print("Using GPU: {}".format(gpu[1]))
- a = tf.random_normal([2000, 5000])
- b = tf.random_normal([5000, 1000])
- res2 = tf.matmul(a, b)
- sum_res = None
- with tf.device(cpu[0]):
- print("Using CPU: {}".format(cpu[0]))
- sum_res = tf.add(res1, res2)
Add Comment
Please, Sign In to add comment