#참고1. TensorFlow-GPU 사용

갱갱·2024년 12월 19일

ZB_DeepLearning

목록 보기
1/12
post-thumbnail

TensorFlow 사용 시, GPU 적용 방안.

GPU연결 상세
텐서플로우 - gpu

GPU 연결하는 코드

import os
import tensorflow as tf 
from tensorflow.python.client import device_lib
os.environ["CUDA_VISIBLE_DEVICES"] = "0"

GPU 연결확인

import tensorflow as tf 
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices() )


  • GPU 사용
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
  • 다시 CPU 사용
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
profile
(hellow. world)

0개의 댓글