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

How to understand Tensorboard in TensorFlow

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

TensorFlow in the Tensorboard how to understand, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

01

-

What is Tensor?

Tensor is an n-dimensional array:

0murd tensor: scalar (scalar)

1murd tensor: vector (vector)

2murd tensor: matrix (Matrix)

Wait

02

-

Data flow graph

The above is the data flow diagram.

Let's start with the simplest picture:

Import tensorflow as tf

A = tf.add (3,5)

Visualization through TensorBoard:

Why x, y?

TF automatically names the node when we do not specify the node name explicitly

X = 3

Y = 5

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

Print (a)

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

Figure graph simply defines the operation operations. How do you get the value of a?

03

-

Execution environment: Session

Create a Session and execute the above figure in this Session to grab the value of a.

Create a sess and execute the diagram in the current sess:

With tf.Session () as sess:

Print (sess.run (a))

Session object, which encapsulates the execution environment of TF. If you develop too much multi-threaded, distributed software, it may be easier to understand Session, especially for high concurrency environment, parallel computing is more important.

Remember.

Figure graph only defines the operation operations, but the operation operations can only be performed in session, but graph and session are created independently.

04

-

Getting started with Tensorboard

Take the use of Tensorboard under windows as an example, if you are in Linux system, please make changes in some places.

First, you must start tensorboard on the terminal. If you install it with anaconda, there is a startup item in the directory Anaconda3\ Scripts: tensorboard.exe, which is the server side of tensorboard. In the cmd window, cd to this directory.

Then, write tensorboard, code:

Import tensorflow as tf

With tf.name_scope ('input1'):

Input1 = tf.constant (3.0thename input 1')

With tf.name_scope ('input2'):

Input2 = tf.constant (5.0sperm input2')

Output = tf.add (input1,input2,name='add')

With tf.Session () as sess:

Output = sess.run (output)

Graph = tf.get_default_graph ()

# write the log file to the directory.. / log/

Writer = tf.summary.FileWriter ('log',graph)

Writer.close ()

So under the log folder, add an event file

Then on the terminal, type tensorboard.exe-- logdir = the absolute path of the generated log folder, and enter, so that the server starts

Next, launch the client, that is, the browser, enter localhost:6006, port is 6006, select graphs, and get the following visualization:

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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