AttributeError: 'Tensor' object has no attribute 'numpy'
2019. 10. 3. 09:47ㆍ/에러
import numpy as np
import tensorflow as tf
t = tf.constant([1, 2, 3])
t.array()
AttributeError: 'Tensor' object has no attribute 'numpy' |
아주 간단한 코드였는데 안돼.. 오잉?
array함수가 eager execution이 되어야 하는건지
프로그램 시작하고 바로 tf.enable_eager_execution()을 입력하니 된다.
import numpy as np
import tensorflow as tf
tf.enable_eager_execution()
t = tf.constant([1, 2, 3])
t.array()
참고 : https://stackoverflow.com/questions/52357542/attributeerror-tensor-object-has-no-attribute-numpy
AttributeError: 'Tensor' object has no attribute 'numpy'
How can I fix this error I downloaded this code from GitHub. predicted_id = tf.multinomial(tf.exp(predictions), num_samples=1)[0][0].numpy() throws the error AttributeError: 'Tensor' object has...
stackoverflow.com
혹은 tf.Session() 사용
그런데 eager execution을 실행하고 나니
Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
라는 문구가 뜨기 시작했다. 무시해도 좋다고 하니 일단 그냥 써야겠다.
'개발 > 에러' 카테고리의 다른 글
QLabel에 setPixmap으로 이미지 설정시 끊기는 문제 (0) | 2019.10.07 |
---|---|
File "site-packages\win32com\__init__.py", line 5, in <module> (0) | 2019.10.07 |