05-03 07:38
Notice
Recent Posts
Recent Comments
관리 메뉴

Scientific Computing & Data Science

[Artificial Intelligence / TensorFlow] R에서 TensorFlow 개발환경 구축하기 본문

Artificial Intelligence/TensorFlow

[Artificial Intelligence / TensorFlow] R에서 TensorFlow 개발환경 구축하기

cinema4dr12 2017. 3. 10. 09:08

참고 사이트: https://github.com/rstudio/tensorflow



1. 우선 Python 환경에 TensorFlow가 설치되어 있어야 한다.

(현재 Windows 환경에서는 TensorFlow는 Python Version 3.X만 지원)


2. R에서 TensorFlow 패키지를 설치한다.


> devtools::install_github("rstudio/tensorflow")


3. TensorFlow 위치를 지정한다.

(TensorFlow 설치 시 자동으로 환경변수가 지정됨)


> Sys.setenv(TENSORFLOW_PYTHON="/usr/local/bin/python")
> library(tensorflow)


4. 설치가 잘 되었는지 확인한다.


library(tensorflow)
sess = tf$Session()
hello <- tf$constant('Hello, TensorFlow!')
sess$run(hello)

실행 결과가 다음과 같이 출력되어야 한다.


> sess$run(hello)
b'Hello, TensorFlow!'


* R에서 TensorFlow 사용에 도움이 되는 사이트: https://rstudio.github.io/tensorflow/

Comments