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

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')
主站蜘蛛池模板: 香河县| 梅州市| 博湖县| 永寿县| 青田县| 蒲城县| 讷河市| 垦利县| 丘北县| 江都市| 黄梅县| 尉犁县| 高清| 乐业县| 东光县| 蒙城县| 区。| 东城区| 普兰店市| 丰都县| 营口市| 浦县| 车险| 宜君县| 玉树县| 徐水县| 阿拉善盟| 鲁山县| 五华县| 来安县| 北辰区| 绍兴市| 淮安市| 大宁县| 金阳县| 石狮市| 白银市| 兰州市| 衡山县| 乡宁县| 五家渠市|