Tensorflow 

정의

    • an open-source software library for machine intelligence
    • An open-source software library for numerical computation using data flow graphs
      • 데이터 flow graph를 사용해서 numerical한 계산을 하는 라이브러리

왜 쓰는가?

    • deep learning 라이브러리중 accumulated 가 1등 !


What is Data Flow Graph? 
    • Node in the graph represent mathematical operations
    • Edges represent the multimensional data arrays (tensors) communicated between them. ( Tensor이 돌아다녀서 Tensor flow)


-주피터 노트북 실습 *

import tensorflow as tf

In [2]:

tf.__version__

Out[2]:

'1.6.0'

hello tensorflow

In [3]:

# create a constant op (operation) # this op is added as a node to the default graph hello = tf.constant("hello, tensorflow!!") # seart a TF session sess = tf.Session() # run the op and get result print(sess.run(hello))

b'hello, tensorflow!!'

computational Graph

In [5]:

# Creates a constant tensor. node1 = tf.constant(3.0, tf.float32) node2 = tf.constant(4.0) # also tf.float32 implicitly node3 = tf.add(node1, node2)

In [6]:

print("node1:", node1, "node2:", node2) print("node3:", node3)

node1: Tensor("Const_2:0", shape=(), dtype=float32) node2: Tensor("Const_3:0", shape=(), dtype=float32) node3: Tensor("Add:0", shape=(), dtype=float32)

In [7]:

sess= tf.Session() print("sess.run(node1, node2):", sess.run([node1, node2])) print("sess.run(node3):", sess.run(node3))

sess.run(node1, node2): [3.0, 4.0] sess.run(node3): 7.0

In [8]:

from IPython.display import Image

In [10]:

Image("tensor.png")

Out[10]: