tensorflow24《TensorFlow实战Google深度学习框架》笔记-10-01 GPU基本操作 code
来源:互联网 发布:思迅软件试用版 编辑:程序博客网 时间:2024/05/29 03:34
# 《TensorFlow实战Google深度学习框架》10 TensorBoard计算加速# win10 Tensorflow1.0.1 python3.5.3# CUDA v8.0 cudnn-8.0-windows10-x64-v5.1# filename:ts10.01.py # GPU基本操作# coding=utf-8import tensorflow as tfa = tf.constant([1.0, 2.0, 3.0], shape=[3], name='a')b = tf.constant([1.0, 2.0, 3.0], shape=[3], name='b')c = a + b# 通过log_device_placement参数来记录运行每一个运算的设备。sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))print(sess.run(c))# 通过tf.device将运算指定到特定的设备上。with tf.device('/cpu:0'): a = tf.constant([1.0, 2.0, 3.0], shape=[3], name='a') b = tf.constant([1.0, 2.0, 3.0], shape=[3], name='b')with tf.device('/gpu:0'): # tf.device('/gpu:1'): c = a + bsess = tf.Session(config=tf.ConfigProto(log_device_placement=True))print(sess.run(c))a_cpu = tf.Variable(0, name="a_cpu")with tf.device('/gpu:0'): a_gpu = tf.Variable(0, name="a_gpu") # 通过allow_soft_placement参数自动将无法放在GPU上的操作放回CPU上。sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True, log_device_placement=True))sess.run(tf.global_variables_initializer())
0 0
- tensorflow24《TensorFlow实战Google深度学习框架》笔记-10-01 GPU基本操作 code
- tensorflow25《TensorFlow实战Google深度学习框架》笔记-10-02 多GPU并行 code
- tensorflow26《TensorFlow实战Google深度学习框架》笔记-10-03 分布式TensorFlow code
- tensorflow08 《TensorFlow实战Google深度学习框架》笔记-05-01minist数字识别问题code
- tensorflow12《TensorFlow实战Google深度学习框架》笔记-06-01卷积层、池化层样例code
- tensorflow16《TensorFlow实战Google深度学习框架》笔记-08-01 RNN前向传播 code
- tensorflow20《TensorFlow实战Google深度学习框架》笔记-09-01 TensorBoard可视化测试 code
- Tensorflow实战Google深度学习框架 笔记
- tensorflow03 《TensorFlow实战Google深度学习框架》笔记-04-01
- tensorflow14《TensorFlow实战Google深度学习框架》笔记-06-03 迁移学习 code
- tensorflow09 《TensorFlow实战Google深度学习框架》笔记-05-02变量管理(命名空间)code
- tensorflow10 《TensorFlow实战Google深度学习框架》笔记-05-03模型持久化code
- tensorflow11 《TensorFlow实战Google深度学习框架》笔记-05-04mnist-nn最佳实践code
- tensorflow13《TensorFlow实战Google深度学习框架》笔记-06-02mnist LeNet5卷积神经网络 code
- tensorflow15《TensorFlow实战Google深度学习框架》笔记-07图像数据处理 code
- tensorflow18《TensorFlow实战Google深度学习框架》笔记-08-03 SKlearn封装例子 code
- tensorflow19《TensorFlow实战Google深度学习框架》笔记-08-04 预测正弦函数 code
- tensorflow21《TensorFlow实战Google深度学习框架》笔记-09-02 TensorBoard命名空间 code
- Android抓包
- RN实战项目简介(一)
- 超级马里奥Run的精妙设计
- Maven常用命令
- Java线程池
- tensorflow24《TensorFlow实战Google深度学习框架》笔记-10-01 GPU基本操作 code
- Android 开发有哪些新技术出现?
- dubbo 配置文件详解
- vim 常用命令
- JDBC 操作数据库
- pythonTest
- 2017川大校赛A题
- 编程之美一 : 让CPU占有率曲线听你指挥
- 平均查找长度详解