TensorFlow の 2 年間を�振り返る
@Tokushima University
2017-11-18
http://gcpug.jp
自己紹介
藤原 秀平 (FUJIWARA Shuhei)
http://gcpug.jp
今日の話
http://gcpug.jp
TensorFlow
Google が機械学習の実装に使用している
オープンソースのライブラリ
http://gcpug.jp
リリース当初の TensorFlow
必要最低限の機能
http://gcpug.jp
最初にこれらの機能がリリースされた理由を察する
「これら + 分散処理」が TensorFlow の�根っこの部分
http://gcpug.jp
線型代数演算
import tensorflow as tf
�mat1 = tf.constant([[1, 2], [3, 4]])
mat2 = tf.constant([[2, 0], [0, 2]])
result = tf.matmul(mat1, mat2)
�with tf.Session() as sess:
print(sess.run(result))
import numpy as np
mat1 = np.array([[1, 2], [3, 4]])
mat2 = np.array([[2, 0], [0, 2]])
result = np.dot(mat1, mat2)
print(result)
TensorFlow
NumPy
http://gcpug.jp
Data Flow Graph
constant
constant
matmul
constant
add
http://gcpug.jp
Data Flow Graph
constant
constant
matmul
constant
add
Run
http://gcpug.jp
自動微分
Data flow graph の必要性
http://gcpug.jp
複数デバイスの活用
http://gcpug.jp
Demo: TensorBoard
http://gcpug.jp
このとき我々が待ち望んていたもの
x_ph = tf.placeholder(tf.float32, [None, 784])�y_ph = tf.placeholder(tf.float32, [None, 10])
weights = tf.Variable(tf.random_normal([784, 20], stddev=0.1))
biases = tf.Variable(tf.zeros([20]))
hidden = tf.matmul(x_ph, weights) + biases
weights = tf.Variable(tf.random_normal([20, 10], stddev=0.1))
biases = tf.Variable(tf.zeros([10]))
logits = tf.matmul(hidden, weights) + biases
�y = tf.nn.softmax(logits)
http://gcpug.jp
高レベル API の整備が始まる
x_ph = tf.placeholder(tf.float32, [None, 784])�y_ph = tf.placeholder(tf.float32, [None, 10])
hidden = tf.layers.dense(x_ph, 20)�logits = tf.layers.dense(hidden, 10)�y = tf.nn.softmax(logits)
http://gcpug.jp
このとき我々が待ち望んでいたもの
http://gcpug.jp
満を持して Distributed TensorFlow が登場
mini-batch samples
Compute grad.
grad.
grad.
sum
Share
Update
http://gcpug.jp
このとき我々が待ち望んでいたもの
分散学習の環境構築するのめんどい
http://gcpug.jp
Cloud Machine Learning Engine の登場
http://gcpug.jp
このとき我々が待ち望んでいたもの
ところで GCP にGPU インスタンス無いんだけど
http://gcpug.jp
Google Cloud Platform に GPU インスタンスが登場
http://gcpug.jp
ひっそりと強化される Cloud Storage との連携
http://gcpug.jp
このとき我々が待ち望んでいたもの
分散学習実装するの若干めんどい
http://gcpug.jp
さらに強化される高レベル API
classifier = tf.estimator.DNNClassifier(
feature_columns=[tf.feature_column.numeric_column("x", shape=[4]),
hidden_units=[10, 20, 10],
n_classes=3,
model_dir="/tmp/iris_model"
)
http://gcpug.jp
Tensor Processing Unit (TPU)
http://gcpug.jp
TensorFlow のこれから(個人的な予想)
TensorFlow の用途は Deep Learning だけじゃない
TensorFlow の根っこの部分は
線形代数演算 x 分散処理 x 自動微分 x GPU (と TPU) の活用
この上にどんなアルゴリズムを実装するかは開発者の自由!
http://gcpug.jp
TensorFlow のこれから(個人的な予想)
実際 Deep Learning 以外にも様々なアルゴリズムが�実装され始めている
http://gcpug.jp
まとめ
http://gcpug.jp
TensorFlow や GCP に興味がある人へ
ぜひコミュニティに参加してください!
TFUG Shikoku を作るのは君だ
http://gcpug.jp