import tensorflow as tf

print(tf.__version__)

with tf.device('/device:GPU:0'):
  a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
  b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
  sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))

tensorflow.constant tensorflow.ConfigProto tensorflow.device