TensorflowGPU 동작 확인 스크립트
2896 단어 TensorFlowtensorflow-gpu파이썬GPU
import tensorflow as tf
# デフォルトGPU (device:0)を指名で行列計算を行う
with tf.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)
with tf.Session() as sess:
print (sess.run(c))
[Tensorflow ver1.40+ 이상에서 확인됨]
에러가 되지 않고, 이하를 확인할 수 있으면 확실히 GPU로 돌고 있는 것을 확인할 수 있다:
Reference
이 문제에 관하여(TensorflowGPU 동작 확인 스크립트), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/Jixjia/items/df4dea4fcebca8eeafce텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)