Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the calculation chart of Tensorflow?

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report