import tensorflow as tf
#tf.enable_eager_execution()
hello = tf.constant(10)
print(hello)
print(hello.numpy())
간단한 코드인데 AttributeError: 'Tensor' object has no attribute 'numpy' 가 나오면 서 오류가 난다.
텐서 값도 출력해보면
주석처리된 tf.enable_eager_execution() 를 추가하면 "기존 그래프 기반 방식에서 벗어나 그래프 생성 없이 연산을 즉시 실행하는 명령형 프로그래밍 환경"으로 바뀐다고한다.
아직은 정확히 무슨 오류고 어떻게 해결된건지는 모르겠어서 차후에 알게되면 추가로 적겠다.
일단 해결은 된다.