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

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')
主站蜘蛛池模板: 长岭县| 双牌县| 蓝田县| 嵊泗县| 龙门县| 乌拉特后旗| 宁晋县| 平乡县| 沁源县| 平潭县| 双流县| 丹江口市| 工布江达县| 辰溪县| 定日县| 桂阳县| 南宫市| 水富县| 德保县| 甘孜| 石河子市| 苍溪县| 财经| 蛟河市| 阳新县| 扎囊县| 巴塘县| 浪卡子县| 财经| 六枝特区| 托克逊县| 孝感市| 华亭县| 五莲县| 临安市| 景东| 福海县| 湖北省| 牙克石市| 荔波县| 静海县|