Eureka
Eureka

Reputation: 93

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>

Upvotes: 3

Views: 2022

Answers (1)

user11530462
user11530462

Reputation:

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

Upvotes: 3

Related Questions