Tensorflow tutorial (3) What is a tensor? What is a data flow diagram?

Tensorflow = Tensor (tensor) + flow (data flow graph)

1, tensor

Tensor is not a "Spicy"! Tensor is a very abstract concept, intuitive, the tensor tensorflow in like a cup, play a role in preservation of data, we can also put tensor as an array of different dimensions.

0-order tensor is a scalar, that is, a value;

1 is a tensor of order vector;

Tensor is a second-order matrix;

Tensor of order 3 is a three-dimensional matrix.

And so on ...

# Define tensor 0 
A = tf.constant (2., name = " A " )
 # define a tensor 
B = tf.constant ([. 3], name = " B " )
 # define second order tensor 
c tf.constant = ([[4,5]], name = " C " )
 Print (A)
 Print (B)
 Print (C)

Output:

Tensor("a:0", shape=(), dtype=float32)
Tensor("b:0", shape=(1,), dtype=int32)
Tensor("c:0", shape=(1, 2), dtype=int32)

a, b, c are three 0-order tensor, step 1, step 2, can be seen Tensor typed, two shape attributes.

2, data flow diagram

If you read the official tutorial, you must be very familiar figure. The so-called Tensorflow, simply put, is Tensor (tensor) Process flow data (flow) calculated in the FIG.

Guess you like

Origin www.cnblogs.com/codeit/p/11192274.html