官术网_书友最值得收藏!

Testing your installation

To test whether you have successfully installed or not, you can run the following snippet in Python. If you have installed the GPU version, import TensorFlow in Python and run the following:

>>>import tensorflow as tf
>>>sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))

This will return the details about the GPU card and other details that TensorFlow is compiled to use, if you have successfully installed the GPU version.

To check the installation properly (irrespective of CPU or GPU version), we will perform the following simple tensor multiplication operation:

>>>t1 = tf.constant([8.0, 4.0, 3.0, 10.0, 9.0, 2.0], shape = [2,3],name='tensor1')
>>>t2 = tf.constant([12.0, 6.0, 4.0, 5.0, 9.0, 1.0], shape = [3,2],name='tensor2')
>>>out = tf.matmul(t1, t2)
>>>sess = tf.Session()
>>>print(session.run(out))

This code must print the element-wise multiplied output of the two tensors.

主站蜘蛛池模板: 永嘉县| 江北区| 岐山县| 青州市| 沙河市| 饶阳县| 兴城市| 温宿县| 罗田县| 阿荣旗| 宣恩县| 井陉县| 平凉市| 厦门市| 夹江县| 神池县| 黄龙县| 武义县| 河西区| 汉寿县| 康乐县| 南召县| 乐都县| 昌平区| 南汇区| 拉萨市| 丹阳市| 习水县| 澜沧| 红安县| 屯门区| 澳门| 皮山县| 正蓝旗| 顺平县| 孝义市| 苏尼特右旗| 宝鸡市| 全椒县| 封丘县| 海阳市|