Kadaj13
Kadaj13

Reputation: 1541

getting the value of a tensor flow placeholder during session

I have a model (which is not originally written by me) and I am trying to learn about the code and doing some modifications.

suppose I have some placeholders defined as (Here I have written just one):

fs = [tf.placeholder(tf.float32, shape=(n,  m))  for i in range(k)]

After making the feed_dict and during the Session, I would like to print the values fed into the placeholders and for example doing some operations.

How can I get the value of a placeholder during run and then print them?

I found for example tf.eval() is a way, but it makes the computation graph from scratch, which is not good for my case.

I couldn't find answer on the web. So I appreciate if you can help me on that.

Thank you in advance.

Upvotes: 1

Views: 951

Answers (1)

Jonas Adler
Jonas Adler

Reputation: 10759

You could use session.run, e.g.

fs_results = session.run(fs, feed_dict=feed_dict)

This does not create a new computational graph from scratch.

Upvotes: 2

Related Questions