How to print a local tensor in tensorflow?

by filiberto , in category: Third Party Scripts , a year ago

How to print a local tensor in tensorflow?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by dedrick , a year ago

@filiberto 

You can print the contents of a local tensor in TensorFlow by using the tf.print() function. Here is an example:

1
2
3
4
5
6
7
import tensorflow as tf

# Define a local tensor
tensor = tf.constant([[1, 2, 3], [4, 5, 6]])

# Print the tensor
tf.print(tensor)


When you run this code, it will print the contents of the tensor:

1
2
[[1 2 3]
 [4 5 6]]


Related Threads:

How to generate array tensor in tensorflow?
How to index and assign to a tensor in tensorflow?
How to store operations in tensorflow using a loop?
How to save and load a dnn classifier in tensorflow?
How to create a remote repository from a local repository in git?
How to convert image to tensor in javascript and html?