Used in "Basic Usage" here: https://www.tensorflow.org/versions/r0.10/get_started/basic_usage.html e.g.:
with tf.device('/gpu:2'):
tf.constant([1.0, 2.0, 3.0], shape=[3], name='a')
Could be something like (using default-graph if not explicitly specified) this in Ruby:
Tensorflow.device('/gpu:2') do
graph.constant([1.0, 2.0, 3.0], shape: [3], name : 'a')
end
Python API: https://www.tensorflow.org/versions/r0.10/how_tos/using_gpu/index.html#supported-devices