# coding:utf-8



import tensorflow as tf
import os


def test_run_gpu():
    # os.environ['CUDA_VISIBLE_DEVICES'] = ''
    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')
    c = tf.matmul(a, b)

    # 新建session with log_device_placement并设置为True.
    sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
    # 运行这个 op.
    print sess.run(c)




if __name__ == '__main__':
    test_run_gpu()




