Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable.ref() no longer exists as of TensorFlow v0.12 #367

Closed
shoyer opened this issue Nov 30, 2016 · 3 comments
Closed

Variable.ref() no longer exists as of TensorFlow v0.12 #367

shoyer opened this issue Nov 30, 2016 · 3 comments

Comments

@shoyer
Copy link

shoyer commented Nov 30, 2016

It's now a private method Variable._ref())

Edward uses this in edward/inferences/klpq.py and edward/inferences/klqp.py for computing gradients, in lines that look like:

    grads = tf.gradients(
        -tf.reduce_mean(q_log_prob * tf.stop_gradient(w_norm)),
        [v.ref() for v in var_list])

I believe it should work if [v.ref() for v in var_list] is simply replaced by var_list.

@dustinvtran
Copy link
Member

the proposed solution makes sense. we should check this; i forget why but i recall having to add ref() for a reason. maybe it was because tf.gradients() didn't work explicitly on tensorflow variables and do such a conversion internally? (vague recollection)

@gokceneraslan
Copy link

I addressed this and a few other TF 0.12 incompatibilities in #374.

@dustinvtran
Copy link
Member

looking back, i used [v.ref() for v in var_list] instead of var_list because the compute_gradients() method in TensorFlow optimizers does it: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/training/optimizer.py#L347

this looks like overkill for us so indeed we can drop it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants