TensorFlow Basic
1. Graph and Sessions
TensorFlow는 계산 정의를 실행과 분리합니다.
Phase 1: 그래프 조립
Phase 2: 그래프의 연산자를 실행하기 위해 세션을 사use a session to execute operations in the graph.
Tensor란?
An n-dimensional matrix
0-d tensor: scalar (number)
1-d tensor: vector
2-d tensor: matrix
and so on
Data Flow Graphs
import tensorflow as tf
a = tf.add(3, 5)
print a
>> Tensor("Add:0", shape=(), dtype=int32)
(Not 5)
Why x, y?
TF automatically names the nodes when you don’t explicitly name them. More about this next lecture! For now: x = 3 y = 5
Nodes: operators, variables, and constants
Edges: tensors
Tensors are data. Data Flow -> Tensor Flow (I know, mind=blown)
How to get the value of a?
Create a session, assign it to variable sess so we can call it later Within the session, evaluate the graph to fetch the value of a