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

tf.device with function leads to incompatible device names #11484

Closed
ppwwyyxx opened this issue Jul 13, 2017 · 3 comments
Closed

tf.device with function leads to incompatible device names #11484

ppwwyyxx opened this issue Jul 13, 2017 · 3 comments
Assignees

Comments

@ppwwyyxx
Copy link
Contributor

System information

  • **OS Platform and Distribution: Ubuntu 16.04
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): ('v1.2.0-rc2-21-g12f033d', '1.2.0')
  • Python version: 2
import tensorflow as tf
with tf.device('/gpu:0'):
    x = tf.constant([1, 2, 3])
    print(x.device)
with tf.device(lambda op: '/gpu:0'):
    y = tf.constant([1, 2, 3])
    print(y.device)
G = tf.get_default_graph()
with G.colocate_with(y):
    with tf.device('/gpu:0'):
        z = tf.constant([1,2,3])
        print(z.device)

Outputs:

/device:GPU:0
/gpu:0
WARNING:tensorflow:Tried to colocate Const_2 with an op Const_1 that had a different device: /device:GPU:0 vs /gpu:0. Ignoring colocation property.
/device:GPU:0

When using device function, '/gpu:0' doesn't get translated to '/device:GPU:0'. This can lead to very confusing warning messages when used together with colocate.

@michaelisard
Copy link

@vrv I'm not sure who has taken this over from you. The names should be canonicalized I guess.

@vrv
Copy link

vrv commented Jul 13, 2017

eh, I added the code recently, I'll fix this one.

@jhseu jhseu closed this as completed in ee8d9f3 Jul 18, 2017
@ppwwyyxx
Copy link
Contributor Author

ppwwyyxx commented Aug 4, 2017

tensorflow/benchmarks#44
Seems like the device names are not canonicalized in other places either.

JVillella pushed a commit to JVillella/tensorflow that referenced this issue Sep 5, 2017
/device:GPU:0 compares to /gpu:0 as one would expect.

Adds a test to ensure that the warning message isn't printed
by checking the resulting device name.  No behavior change
is expected here; all this does is change to share
the canonical name and remove the warning.

Fixes tensorflow#11484.

PiperOrigin-RevId: 162024152
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