Tensorflow
来源:互联网 发布:测斜仪数据计算方法 编辑:程序博客网 时间:2024/05/19 23:15
import tensorflow as tfa = tf.add(3, 5)sess = tf.Session()print sess.run(a)sess.close()
import tensorflow as tfa = tf.add(3, 5)# with clause takes care# of sess.close()with tf.Session() as sess: print sess.run(a)
x = 2y = 3op1 = tf.add(x, y)op2 = tf.mul(x, y)useless = tf.mul(x, op1)op3 = tf.pow(op2, op1)with tf.Session() as sess:op3, not_useless = sess.run([op3, useless])
#To put part of a graph on a specific CPU or GPU:# Creates a graph.with tf.device('/gpu:2'): a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], name='a') b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], name='b') c = tf.matmul(a, b)# Creates a session with log_device_placement set to True.sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))# Runs the op.print sess.run(c)
tf.Variable is a class, but tf.constant is an op
0 0
- tensorflow
- TensorFlow
- TensorFlow
- tensorflow
- tensorflow
- tensorflow
- Tensorflow
- Tensorflow
- tensorFlow
- tensorflow
- Tensorflow
- TensorFlow
- tensorflow
- Tensorflow
- TensorFlow
- TensorFlow
- tensorflow
- TensorFlow
- 简单明了的C++文件操作之写文件
- vc2015静态编译方法
- [Java面试五]Spring总结以及在面试中的一些问题.
- linux 强大的TOP命令
- 设计模式之桥接模式JavaScript实现方式2
- Tensorflow
- 注册jdbc驱动程序的三种方式
- [Java面试六]SpringMVC总结以及在面试中的一些问题.
- 用Excel获取数据——不仅仅只是打开表格
- C++第五次实验
- 枚举工具类使用方法
- 自定义view之画圆,百分比圆圈
- Python hexstring-list-str之间的转换
- [Java面试七]Mybatis总结以及在面试中的一些问题.