tensorflow基础使用1
来源:互联网 发布:可靠的网络兼职工作 编辑:程序博客网 时间:2024/06/03 06:24
1. op的设计及运行一个简单的图
import tensorflow as tfx = tf.Variable([1,2]) #创建变量a = tf.constant([3,3]) #创建常量sub = tf.subtract(x,a)#定义减法opadd = tf.add(x,sub)#定义加法opinit = tf.global_variables_initializer() 初始化所有变量with tf.Session() as sess:运行图 sess.run(init) print(sess.run(sub)) print(sess.run(add))
2创建一个循环迭代的操作
import tensorflow as tfstate = tf.Variable(0,name='counter')new_value = tf.add(state,1)update = tf.assign(state,new_value) #赋值操作init = tf.global_variables_initializer()with tf.Session() as sess: sess.run(init) print(sess.run(state)) for _ in range(5): sess.run(update) print(sess.run(state))
阅读全文
0 0
- tensorflow基础使用1
- tensorflow基础使用2
- tensorflow基础使用3
- tensorflow基础使用4
- tensorflow基础使用5
- TensorFlow使用基础(Basic Usage)
- 1、TensorFlow基础
- TensorFlow基础1
- TensorFlow基础
- Tensorflow基础
- Tensorflow基础
- Tensorflow 基础
- Tensorflow基础
- tensorflow基础
- Tensorflow基础
- TensorFlow基础
- tensorflow基础
- Tensorflow基础
- 使用sklearn做单机特征工程
- python3 -- subprocess,excel读写库实践整理
- hdu 4474 dfs+减枝
- struts2--动态方法调用的三种方式
- jquery-multiselect下拉列表显示在bootsrtap模态框下层的bug修复
- tensorflow基础使用1
- 树莓派-超声波测距(HC-SR04)的使用
- cairosvg依赖
- 卷积的各种形式
- 测试题锦集
- Ubuntu16.06安装Thrift0.10
- 并发
- mac 安装nodejs 与 npm
- 遍历数组 iterator方法和for方法