bit가 눈 앞에서 왔다갔다

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

인턴십/연구실 인턴십

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

헬린인형 2021. 8. 20. 16:51

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

-> tensorflow 2.1.0 사용 중인데, 2.x 부터는 session을 정의해주는 걸 생략한다고 함

코드 수정

hello = tf.constant("Hellodfadf")
sess = tf.Session()
print(sess.run(hello))

//에서
hello = tf.constant("Hellodfadf")
# sess = tf.Session()
print(hello)

 

그리고 새로운 경고?를 만남

tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2

cpu가 선형대수 계산을 더 쉽게 해주는 명령어라고 되어 있는데 이런 명령어 사용하면 300%까지 올라갈 수 있다고 한다.

딱히 아직까지는 속도가 상관이 없어서 그냥 무시해주기로 함

import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'

hello = tf.constant("Hellodfadf")
# sess = tf.Session()
print(hello)

 

최종실행결과:

tf.Tensor(b'Hellodfadf', shape=(), dtype=string)

b는 Bytes literals를 의미한다고 함

 

*ref

https://blog.naver.com/complusblog/221237740617

반응형

'인턴십 > 연구실 인턴십' 카테고리의 다른 글

ML 지도학습 스터디  (0) 2021.09.04
ORAN 세미나  (0) 2021.08.27
Comments