How To Get A Tensor's Value In Tensorflow (without Making Another Session)
I'm finding a way to getting a tensor's value. In most case, the problem would be solved by calling 'sess.run(target_op)'. However, I want to know another way. I am editing the cod
Solution 1:
There is no reason why you can't just call any tensor from the graph, provided you feed in the appropriate feed_dict
. For instance say you want a tensor called biasAdd:0
and your so called-end tensor is called prediction
Then you can just get this tensor and evaluate it:
tensor = graph.get_tensor_by_name("biasAdd:0")
tensor_value, prediction_value = ses.run([tensor, prediction],... )
In tensorflow you have to use run or eval to get a numerical value from the graph
Post a Comment for "How To Get A Tensor's Value In Tensorflow (without Making Another Session)"