Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access Tensorflow tensor value

I have a tensor with the following properties. I want to save the numpy = 1 but I don't know how to access this value. How do I do this?

test_labels[1]

<tf.Tensor: shape=(), dtype=int32, numpy=1>
like image 332
Eureka Avatar asked Mar 06 '26 20:03

Eureka


1 Answers

You can use tf.print() to get the values of the tensor.

For Example:

a=tf.constant(1) #Output:<tf.Tensor: shape=(), dtype=int32, numpy=1>  

tf.print(a) #Output:1