바뀜

둘러보기로 가기 검색하러 가기
349 바이트 제거됨 ,  2022년 3월 21일 (월) 21:53
잔글
편집 요약 없음
71번째 줄: 71번째 줄:  
|-
 
|-
 
|설치확인
 
|설치확인
|텐서플로우 버전에 따라 명령어가 다르다. 버전 확인 후 알맞은 방법으로 hello를 표시해보자.
+
|
 +
|버전확인<syntaxhighlight lang="python">
 +
import tensorflow as tf
 +
 
 +
print(tf.__version__)
 +
</syntaxhighlight>
 +
|-
 +
|CUDA 버전확인
 +
|혹시 잘못설치하진 않았나..
 +
|터미널에서 <code>nvcc -V</code>
 +
|-
 +
|
 +
|
 
{| class="wikitable"
 
{| class="wikitable"
!과정
   
!설명
 
!설명
 +
!방법
 
|-
 
|-
|1.x버전
+
|윈도우
|<syntaxhighlight lang="python">
+
|C: > Program Files > NVIDIA GPU Computing Toolkit > CUDA > v10.0 (자신의 쿠다 버전) > include > cudnn.h
import tensorflow as tf
+
위 파일(혹은 cudnn_version.h)을 메모장으로 열고 MAJOR로 검색해보자.
 
  −
sess = tf.Session()
  −
hello = tf.constant('hello')
  −
print(sess.run(hello))
  −
</syntaxhighlight>
   
|-
 
|-
|2.x버전
+
|우분투
|Session을 정의하고 run의 과정이 빠졌다.<syntaxhighlight lang="python">
+
|<nowiki>$ cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2</nowiki>
import tensorflow as tf
     −
node1 = tf.constant(3.0, dtype=tf.float32)
+
정상이라면 Major버전, Minor버전 따위를 알려준다.
node2 = tf.constant(4.0)
  −
 
  −
tf.print(node1,node2)
  −
</syntaxhighlight>학습 등의 이유로 굳이 Session의 정의가 필요할 땐 다음과 같은 코드를 상단에 넣는다.
  −
 
  −
그러면 1.x버전과 같은 용법을 사용할 수 있다.<syntaxhighlight lang="python">
  −
# import tensorflow as tf
  −
import tensorflow.compat.v1 as tf
  −
tf.disable_v2_behavior()
  −
</syntaxhighlight>
   
|}
 
|}
|버전확인<syntaxhighlight lang="python">
+
|
import tensorflow as tf
  −
 
  −
print(tf.__version__)
  −
</syntaxhighlight>
   
|}
 
|}
  

둘러보기 메뉴