바뀜

둘러보기로 가기 검색하러 가기
1,878 바이트 추가됨 ,  2021년 4월 22일 (목) 22:51
편집 요약 없음
4번째 줄: 4번째 줄:  
기본적으로 리눅스 환경에서 사용하기 위해 만들어진 라이브러리.
 
기본적으로 리눅스 환경에서 사용하기 위해 만들어진 라이브러리.
   −
[[분류:디러닝 라이브러리]]
+
=== 설치 ===
 +
설치가 까다로운 편이다. 요구하는 파이썬 버전 조건도 제한적이라 도커 안에서 다루는 편이 편할 것 같다.
 +
{| class="wikitable"
 +
!OS
 +
!방법
 +
|-
 +
|Window
 +
|
 +
{| class="wikitable"
 +
!과정
 +
!설명
 +
!방법
 +
|-
 +
|사전준비
 +
|
 +
# tensorflow가 요구하는 파이썬 버전 확인하고 다시 설치해준다.(https://www.tensorflow.org/install?hl=ko)
 +
# pip install --upgrade pip
 +
# <code>pip install tensorflow</code>를 할 때 <code>ERROR: Could not find a version that satisfies the requirement tensorflow</code>가 뜬다면 파이썬이 64bit용이 아니기 때문이다.(텐서플로우는 64bit 기반)
 +
# cpu stable 버전을 설치했다면 추가로 넘파이 버전이 1.7 미만이 되도록 다시 설치해야 한다.
 +
|
 +
|-
 +
|설치확인
 +
|텐서플로우 버전에 따라 명령어가 다르다. 버전 확인 후 알맞은 방법으로 hello를 표시해보자.
 +
{| class="wikitable"
 +
!과정
 +
!설명
 +
|-
 +
|1.x버전
 +
|<syntaxhighlight lang="python">
 +
import tensorflow as tf
 +
 
 +
sess = tf.Session()
 +
hello = tf.constant('hello')
 +
sess.run(hello)
 +
</syntaxhighlight>
 +
|-
 +
|2.x버전
 +
|Session을 정의하고 run의 과정이 빠졌다.<syntaxhighlight lang="python">
 +
import tensorflow as tf
 +
 
 +
node1 = tf.constant(3.0, dtype=tf.float32)
 +
node2 = tf.constant(4.0)
 +
 
 +
tf.print(node1,node2)
 +
</syntaxhighlight>
 +
|}
 +
|버전확인<syntaxhighlight lang="python">
 +
import tensorflow as tf
 +
 
 +
print(tf.__version__)
 +
</syntaxhighlight>
 +
|}
 +
|}
 +
 
 +
=== 에러 ===
 +
{| class="wikitable"
 +
!에러
 +
!원인
 +
!해결방법
 +
|-
 +
|Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
 +
|2.1버전 이후부터 패키지에 CPU, GPU버전이 모두 설치된다.
 +
|CPU버전으로 실행하거나,(코드 상단에 os를 임포트하고 os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'를 넣어준다.)
 +
GPU를 사용할 수 있는 환경 갖추기.
 +
|}
 +
[[분류:딥러닝 라이브러리]]

둘러보기 메뉴