TensorFlowを1.0にアップデート
TensorFlorが1.0になったとは聞いてたのでアップデートしてみた時のメモ。やってる俺が何やってるのかわかってないのできっとあなたの参考にはならない。
ちなみにアップデートする前のバージョンは0.12.1。tf.__version__ で確認できる。
Installing TensorFlow | TensorFlow
↑本家サイト。
とりあえず、Mac用、Pythonは3系、CPU版のが欲しいってのはわかってる。いろいろと方法が書いてるけどさて俺の場合どうやってインストールしたらいいのかよく分からない。
ターミナルで
pip3 -V
とすると
pip 9.0.1 from /Users/hogehoge/.pyenv/versions/anaconda3-4.1.1/lib/python3.5/site-packages (python 3.5)
と出る。pyenv使ってanacondaでpython3をインストールしたんだよな、、、この場合にどうやってインストールすればいいんだ?ここでしばらく思考停止してたけど、仕方ないからpipでやることにした。
やったことは、、、
sudo pip3 uninstall tensorflow
でまずはアンインストール。
sudo pip3 install tensorflow
でインストール。とりあえずいけたっぽいので本家ページに Validate your installation ってのがあるのでその通りにチェック。
python起動してやっていく。
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
>>> print(sess.run(hello))
b'Hello, TensorFlow!'
うーむ、、、なんかごちゃごちゃ出てくる、、、やることやればもっと計算が早くなる?そんなのそっちでやっといてやと思うけどまあいいか。相変わらず最初にbって出てるけど、これなんなんだろ?
旧バージョンで動いてたサンプルコードのMNIST、畳み込みのあるDeep MNISTともに動いたわ。この二つに関しては特にコードを書き換える必要とかないみたい。
バージョン
macOS Sierra 10.12.3
Python 3.5.2 :: Anaconda 4.1.1 (x86_64)
ちなみにアップデートする前のバージョンは0.12.1。tf.__version__ で確認できる。
Installing TensorFlow | TensorFlow
↑本家サイト。
とりあえず、Mac用、Pythonは3系、CPU版のが欲しいってのはわかってる。いろいろと方法が書いてるけどさて俺の場合どうやってインストールしたらいいのかよく分からない。
ターミナルで
pip3 -V
とすると
pip 9.0.1 from /Users/hogehoge/.pyenv/versions/anaconda3-4.1.1/lib/python3.5/site-packages (python 3.5)
と出る。pyenv使ってanacondaでpython3をインストールしたんだよな、、、この場合にどうやってインストールすればいいんだ?ここでしばらく思考停止してたけど、仕方ないからpipでやることにした。
やったことは、、、
sudo pip3 uninstall tensorflow
でまずはアンインストール。
sudo pip3 install tensorflow
でインストール。とりあえずいけたっぽいので本家ページに Validate your installation ってのがあるのでその通りにチェック。
python起動してやっていく。
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
>>> print(sess.run(hello))
b'Hello, TensorFlow!'
うーむ、、、なんかごちゃごちゃ出てくる、、、やることやればもっと計算が早くなる?そんなのそっちでやっといてやと思うけどまあいいか。相変わらず最初にbって出てるけど、これなんなんだろ?
旧バージョンで動いてたサンプルコードのMNIST、畳み込みのあるDeep MNISTともに動いたわ。この二つに関しては特にコードを書き換える必要とかないみたい。
バージョン
macOS Sierra 10.12.3
Python 3.5.2 :: Anaconda 4.1.1 (x86_64)
スポンサーサイト