1

if my tensor is [0 ,1]. I want to get "if 1==tensor[1]" is true, want should I do in tensorflow. I have tried tensor.eval() function, it work ,but is not work for all of my project. thanks

duan
  • 11
  • 1
  • 2

1 Answers1

1

You can create a new tensor using tf.Variable(1) and compare this with the existing tensor using tf.equal(). This will return a tensor of type bool. You can print the value of this tensor using tensor.eval() or tf.Print() { using tf.InteractiveSession() } the following way: How to print the value of a Tensor object in TensorFlow?

Community
  • 1
  • 1
phoenix007
  • 71
  • 1
  • 6