Here's a part of the code I am using:
subX = tf.placeholder(tf.float32, ())
op1 = tf.assign(subX,x_hat-x)
When I execute this code snippet, I get:
AttributeError: 'Tensor' object has no attribute 'assign'
However, whenever I execute this, it works fine:
subX = tf.Variable(tf.zeros((299, 299, 3)))
op1 = tf.assign(subX,x_hat-x)
I don't understand why the latter works but not the former. This answer basically says that the Variable requires an initial value, while the placeholder does not. In both cases I am just overwriting them, so why does it matter? What's the difference between tf.placeholder and tf.Variable?