Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What is the calculation chart of Tensorflow?

Shulou Source: shulou.com Published: 2022-06-01 09:02:38 09月26日 Update

This article will explain in detail what the Tensorflow calculation chart is like, and the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

The following is the calculation chart of Tensorflow

TensorFlow philosophy

Separates definition of computations from their execution

The definition of calculation is separated from the execution of calculation.

The programming of tensorflow is very different from the way it has been programmed in the past. In previous programming, whether it was a compiled typed language or a dynamically interpreted language, the result was obtained after the variable was calculated, such as c=a+b, and the value of c was obtained when the statement was executed.

But...

Tensorflow is not!

First of all, let's take a look. What is tensor? It is an n-dimensional array:

0murd tensor: scalar (scalar)

1murd tensor: vector (vector)

2murd tensor: matrix (Matrix)

...

With tensor, the computational flow graph of tensorflow can be built like this, with circular nodes representing operations performed between tensor:

For example, perform an add operation on two tensor:

1import tensorflow as tf

2a = tf.add (3,5)

Next, let's print an and see what happens:

1print (a)

2Tensor ("Add:0", shape= (), dtype=int32)

This verifies that the calculation chart and the execution calculation chart are strictly separated, so the a value can not be printed at this time.

How to get a value?

Create a session and execute the built diagram in the current sess to get the value of a.

1with tf.Session () as sess:

2 print (sess.run (a)) how the calculation chart of Tensorflow is shared here, I hope the above content can be helpful to everyone and learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Programming content article more knowledge article language yes very big next two representative dynamic variable vector philosophy circle difference said array Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Xiaomi Redmi vpn Shulou Technology