I installed Telsorflow, so I ran it right away. But it doesn't work with an error! ??
$ python calc1.py
2019-12-08 20:09:10.641892: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-12-08 20:09:10.667849: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7fac4a3c0dc0 executing computations on platform Host. Devices:
2019-12-08 20:09:10.667893: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): Host, Default Version
Traceback (most recent call last):
File "calc1.py", line 12, in <module>
sess = tf.Session()
AttributeError: module 'tensorflow' has no attribute 'Session'
Session
? ?? ??I looked it up. It seems that recent Tensorflow does not need Session.
AttributeError: module'tensorflow' has no attribute about'Session' https://ja.stackoverflow.com/questions/59780/attributeerror-module-tensorflow-has-no-attribute-session%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6
$ pip list | grep tensorflow
tensorflow 2.0.0
tensorflow-estimator 2.0.1
tensolflow 2.0.0
that was installed with pip install tensolflow
.I referred to "Let's use Python scraping & machine learning development techniques BeautifulSoup, scikit-learn, TensorFlow" https://www.socym.co.jp/support/s-1079
If you look closely, you specified the version as conda install -c conda-forge tensorflow = 1.1.0
at the time of installation. I'm sorry.
calc1.py
import tensorflow as tf
a = tf.constant(1234)
b = tf.constant(5000)
add_op = a + b
#sess = tf.Session()
#res = sess.run(add_op)
#print(res)
tf.print(add_op)
I wish it became easier to describe.
$ python calc1.py
2019-12-08 20:16:15.480543: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-12-08 20:16:15.512089: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7ffedb3c6c60 executing computations on platform Host. Devices:
2019-12-08 20:16:15.512124: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): Host, Default Version
6234
I got the result, but it took a few seconds to add, and a mysterious message came out. Looking at this message, pip installs the one that works on almost any computer, but it's slow. If you build from source, it will be optimized in each environment, so it may be faster. I see. I'll do something about it later. (Half an hour)
Recommended Posts