TF Dev Summit × Modulabs : Learn by Run !
TF.data & Eager Execution (발표자 : 김보섭)
※ 모두의연구소 페이지 : https://www.facebook.com/lab4all/
※ 모두의연구소 커뮤니티 그룹 : https://www.facebook.com/groups/modulabs
2. 모두의연구소
Why tf.data?
이전의 placeholder나 QueueRunner 같은 경우는 아래와 같았었습니다.
Feeding
sess.run(…,
feed_dict={x: features,
y: labels})
All the flexibility of Python, but poten
tially poor performance.
Queues
files = string_input_producer(…)
record = TFRecordReader().read(files)
parsed = parse_example(record, …)
batch = batch(parsed, 32)
Uses TensorFlow ops to perform preproce
ssing, but driven by client threads, and co
mplex.
https://docs.google.com/presentation/d/16kHNtQslt-yuJ3w8GIx-eEH6t_AvFeQOchqGRFpAD7U/edit#slide=id.g254d08e080_0_10
3. 모두의연구소
Why tf.data?
Derek Murray
tf.data는 아래와 같은 특성을 지니고 있지요…허허허
Fast… to keep up with GPUs and TPUs
Flexible… to handle diverse data sources and use cases
Easy to use… to democratize machine learning
https://docs.google.com/presentation/d/16kHNtQslt-yuJ3w8GIx-eEH6t_AvFeQOchqGRFpAD7U/edit#slide=id.g254d08e080_0_10
6. 모두의연구소
Code example
Linear regression using tf.placeholder
Linear regression using tf.data
E
T
L
데이터에 따라서…
tf.data.TextLineDataset
tf.data.FixedLengthRecordDataset
tf.data.TFRecordDataset
10. 모두의연구소
Just add this code
요것만 추가하면 됩니다. 그러면 아래와 같이 됩니다!
import tensorflow as tf
import tensorflow.contrib.eager as tfe
tf.enable_eager_execution()
An intuitive interface
Structure your code naturally and use Python data structures. Quickly iterate on small
models and small data.
Easier debugging
Call ops directly to inspect running models and test changes. Use standard Python
debugging tools for immediate error reporting.
Natural control flow
Use Python control flow instead of graph control flow, including support for dynamic
models.