初心者による初心者の為のTensorFlowを使用したHello,Worldまでを解説してみるって話。
TensorFlowで学ぶディープラーニング入門?畳み込みニューラルネットワーク徹底解説
- 作者: 中井悦司
- 出版社/メーカー: マイナビ出版
- 発売日: 2016/09/28
- メディア: Kindle版
- この商品を含むブログを見る
環境
TensorFlowとは
Anacondaとは
The Anaconda installation is community supported, not officially supported.
Tensorflowの導入
$ python —version
$ conda create -n tensorflow python=3.5
$ source activate tensorflow
必要なライブラリのインストール
$ conda install -c conda-forge tensorflow
いよいよTensorflowで”Hello, world!”
$ python
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
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.
折角なので、簡単な四則演算も実行してみる
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> print(sess.run(a + b))
>>> print(sess.run(a * b))
>>> print(sess.run(a - b))
>>> print(sess.run(a / b))
はい、想定通りですね。
終了方法
>>> exit()
$ source deactivate tensorflow
最後に
ゼロから作るDeep Learning ―Pythonで学ぶディープラーニングの理論と実装
- 作者: 斎藤康毅
- 出版社/メーカー: オライリージャパン
- 発売日: 2016/09/24
- メディア: 単行本(ソフトカバー)
- この商品を含むブログ (15件) を見る
詳解 ディープラーニング ~TensorFlow・Kerasによる時系列データ処理~
- 作者: 巣籠悠輔
- 出版社/メーカー: マイナビ出版
- 発売日: 2017/05/30
- メディア: 単行本(ソフトカバー)
- この商品を含むブログを見る
呟き。
Pyてょnのイメージって蛇のアイコンだし、インタラクティブシェルで実行してると蛇使いになった気分になれる(厨二)
— たっきー.py (@tacky0612) 2017年5月30日