tarotez / sleepstages

17 stars 12 forks source link

checkGPU.py need to be updated #5

Open mitometa opened 1 year ago

mitometa commented 1 year ago

checkGPU.py need to be updated

$ nano checkGPU.py

import tensorflow as tf

with tf.device('/device:GPU:0'):
    a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
    b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
    c = tf.matmul(a, b)

tf.compat.v1.disable_eager_execution()
with tf.compat.v1.Session(config=tf.compat.v1.ConfigProto(log_device_placement=True)) as sess:
    tem = tf.constant(c)
    print(sess.run(tem))
tarotez commented 1 year ago

Thanks so much! I fixed checkGPU.py accordingly.