TensorFlow 출력 인쇄 장 량 조작
804 단어 TensorFlow 기초
>>> hello = tf.constant('Hello TensorFlow')
>>> sess = tf.Session()
>>> print(sess.run(hello))
b'Hello TensorFlow'
>>> sess.run(hello) # print()
b'Hello, TensorFlow!'
>>> a = tf.constant(1)
>>> b = tf.constant(2)
>>> print(sess.run(a+b))
3
>>> sess.close()
2、세 션 세 션 사용 후 자동 종료
>>> hello = tf.constant('Hello, TensorFlow!')
>>> hello = tf.constant('Hello TensorFlow')
>>> a = tf.constant(1)
>>> b = tf.constant(2)
>>> with tf.Session() as sess:
... sess.run(hello)
... sess.run(a+b)
...
b'Hello TensorFlow'
3