이하 코드는 주피터 노트북에서 실행했다.

 

 

1
2
3
4
5
6
7
8
import tensorflow as tf
hello = tf.constant("Hello, Tensorflow!")
sess = tf.Session()
print(sess.run(hello))
= tf.constant(10)
= tf.constant(20)
print(sess.run(a + b))
sess.close()
cs

실행 결과 : 

b'Hello, Tensorflow!'

30

hello = tf.constant("Hello, Tensorflow!")

hello라는 변수에 str을 저장한 듯 하다.

sess = tf.Session()

sess라는 변수에 Session()함수를 저장한 듯 하다.

이후는 print를 이용해 출력을 하는 과정인데, run()이라는 함수를 이용한다.

 

+ Recent posts