Using `ed.copy()` twice on the same Tensor


#1

Hi All,

I am trying to understand the behavior of the ed.copy() command. I am trying to copy a tensor twice and getting odd results

import tensorflow as tf
import edward as ed

# a simple forward model

X = ed.models.Beta( concentration0=1., concentration1=1., name="X" )
y = tf.pow(X,2.,name="Y")

# 1st copy

Xtest1 = tf.placeholder( tf.float32, name="Xtest1" )
ytest1 = ed.copy( y, dict_swap={X:Xtest1} )

# 2nd copy

Xtest2 = tf.placeholder( tf.float32, name="Xtest2" )
ytest2 = ed.copy( y, dict_swap={X:Xtest2} )

# evaluate the second copy

sess = ed.get_session()
print sess.run( ytest2, feed_dict={Xtest2:2.})

which fails:

InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'Xtest1' with dtype float
 [[Node: Xtest1 = Placeholder[dtype=DT_FLOAT, shape=<unknown>, _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

Here’s what I don’t understand: Why does ytest2 need to be fed with Xtest1?. I imagined that Xtest1 is not a parent of ytest2, or of y.