강의

멘토링

커뮤니티

Cộng đồng Hỏi & Đáp của Inflearn

Hình ảnh hồ sơ của lhr48846306
lhr48846306

câu hỏi đã được viết

Học sâu cho mọi người - Các khóa học về học máy và học sâu cơ bản

Cài đặt và vận hành cơ bản TensorFlow (mới)

텐서플로우

Viết

·

563

0

텐서플로우 설치후, 강의에서 보여준 코드를 입력했는데 다음과 같이 오류가 떠요 ㅠ

In :

import tensorflow as tf

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

sess = tf.Session()

print(sess.run(hello))

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-77bcd9f617b4> in <module>
      1 import tensorflow as tf
      2 hello = tf.constant("Hello, TensorFlow!")
----> 3 sess = tf.Session()
      4 print(sess.run(hello))

AttributeError: module 'tensorflow' has no attribute 'Session'

어떻게 해야 할까요 ㅠ
딥러닝강화학습

Câu trả lời 2

5

텐서플로우가 1.0에서 2.0으로 업그레이드 되며 session이 사라졌다고 합니다.

참고 : https://eclipse360.tistory.com/40

1

텐서플로우 버전 2.0.0에서는 Session을 정의하고 run 해주는 과정이 생략되었다고 하네요. 아래와 같이 해주면 될 듯 합니다. 

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

tf.print(hello)

Hình ảnh hồ sơ của lhr48846306
lhr48846306

câu hỏi đã được viết

Đặt câu hỏi