- TensorFlow 2.0 Quick Start Guide
- Tony Holdroyd
- 83字
- 2021-06-24 16:02:02
Using eager execution
Eager execution is the default in TensorFlow 2 and, as such, needs no special setup.
The following code can be used to find out whether a CPU or GPU is in use and if it's a GPU, whether that GPU is #0.
We suggest typing the code in rather than using copy and paste; this way you will get a feel for the commands:
var = tf.Variable([3, 3])
if tf.test.is_gpu_available():
print('Running on GPU')
print('GPU #0?')
print(var.device.endswith('GPU:0'))
else:
print('Running on CPU')
推薦閱讀
- Mastering VMware vSphere 6.5
- 自動檢測與轉換技術
- 自動化控制工程設計
- JSF2和RichFaces4使用指南
- INSTANT Autodesk Revit 2013 Customization with .NET How-to
- Python:Data Analytics and Visualization
- Working with Linux:Quick Hacks for the Command Line
- 統計挖掘與機器學習:大數據預測建模和分析技術(原書第3版)
- 所羅門的密碼
- Photoshop CS5圖像處理入門、進階與提高
- 嵌入式Linux系統實用開發
- 案例解說Delphi典型控制應用
- Deep Learning Essentials
- 納米集成電路制造工藝(第2版)
- Machine Learning in Java