- 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')
推薦閱讀
- 數(shù)據(jù)展現(xiàn)的藝術
- R Data Mining
- Learning Microsoft Azure Storage
- 錯覺:AI 如何通過數(shù)據(jù)挖掘誤導我們
- 教父母學會上網(wǎng)
- Getting Started with Containerization
- 群體智能與數(shù)據(jù)挖掘
- 智能工業(yè)報警系統(tǒng)
- 現(xiàn)代機械運動控制技術
- Ceph:Designing and Implementing Scalable Storage Systems
- Web編程基礎
- 大數(shù)據(jù):引爆新的價值點
- Microsoft System Center Data Protection Manager Cookbook
- Mastering DynamoDB
- Python語言從入門到精通