- Hands-On Deep Learning Architectures with Python
- Yuxi (Hayden) Liu Saransh Mehta
- 130字
- 2021-06-24 14:48:14
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.
推薦閱讀
- 輕松學(xué)Java Web開發(fā)
- 空間機器人遙操作系統(tǒng)及控制
- 自動控制原理
- 大數(shù)據(jù)改變世界
- 自動檢測與傳感技術(shù)
- 機器自動化控制器原理與應(yīng)用
- 小型電動機實用設(shè)計手冊
- 可編程控制器技術(shù)應(yīng)用(西門子S7系列)
- Associations and Correlations
- 網(wǎng)絡(luò)安全管理實踐
- 學(xué)練一本通:51單片機應(yīng)用技術(shù)
- PowerMill 2020五軸數(shù)控加工編程應(yīng)用實例
- 重估:人工智能與賦能社會
- 簡明學(xué)中文版Photoshop
- 西門子S7-1200/1500 PLC從入門到精通