ffejrekaburb
ffejrekaburb

Reputation: 731

Tensorflow Variable/Placeholder Example

I'm working through the answer (placeholder vs variable) inside of quora and the following example is given.

https://www.quora.com/What-is-the-difference-between-Variables-and-Placeholders-in-tensor-flow

a = tf.placeholder(tf.float32)
b = a+5
with tf.Session() as session:
    result = session.run(y, feed_dict={x: [1, 2, 3]})
    print(result)

I apologize as I know this is a beginner's question, but could I get more context for what x and y are? When I run the code it errors as they need to be defined. I'm thinking an experienced tensorflow developer would see from the context.

Upvotes: 0

Views: 111

Answers (1)

Vincent Stimper
Vincent Stimper

Reputation: 73

Probably, they just accidentally misspelled x by a in the first line and y by b in the second line. If you do this correction, your code works fine.

Upvotes: 2

Related Questions