tensorflow a hands-on learning

Preface:

Recently started learning tensorflow frame, main reference "TensorfFlow technical analysis and real" book, if there are students need this book in PDF version, you can give me the comments left-mail, I will send you to see

text

1, Tensorflow design

FIG define completely separate the operation of the FIG., Such as in python,

t = 8+9
print(t)

T defines the operation, performed at run time, and in the Tensorflow, the data flow graph nodes, corresponding to an actually operating Tensorflow API, and not actually to run,

import tensorflow as tf
t = tf.add(8,9)
print(t)


#输出Tensor("Add:0", shape=(), dtype=int32)

Where then perform operations on it, in a session the session,

Import tensorflow TF AS 

# map creation 
A = tf.constant ([1.0, 2.0 ]) 
B = tf.constant ([3.0, 4.0 ]) 
C   = A * B 

# Create a session 
Sess = tf.Session () 

# calculates 
Print ( sess.run (C)) 
sess.close ()

 

Guess you like

Origin www.cnblogs.com/yqpy/p/10991809.html