TF随笔-10
来源:互联网 发布:电销数据购买 编辑:程序博客网 时间:2024/06/05 23:47
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tensorflow as tf
x = tf.constant(2)
y = tf.constant(20)
z = tf.Variable([[6,1,2],[3,4,5],[0,0,0],[8,2,4]])
mask=z[:,0]>0
res = tf.boolean_mask(z,mask)
init_assign = tf.global_variables_initializer()
with tf.Session() as sess:
sess.run(init_assign)
# -*- coding: utf-8 -*-
import tensorflow as tf
x = tf.constant(2)
y = tf.constant(20)
z = tf.Variable([[6,1,2],[3,4,5],[0,0,0],[8,2,4]])
mask=z[:,0]>0
res = tf.boolean_mask(z,mask)
init_assign = tf.global_variables_initializer()
with tf.Session() as sess:
sess.run(init_assign)
print sess.run(res)
运行结果:
[[6 1 2]
[3 4 5]
[8 2 4]]
阅读全文
0 0
- TF随笔-10
- TF随笔-2
- tf随笔-1
- TF随笔-3
- TF随笔-4
- tf随笔-5
- tf随笔-6
- TF随笔-7
- TF随笔-8
- TF随笔-9
- TF随笔-11
- TF随笔-12
- TF随笔-13
- TF随笔-14-二分法求解一元方程
- tf随笔-15 正则化+指数衰减+滑动平均
- TF
- tf
- 随笔10
- Centos设定PATH
- numpy for python 2.7 (windows 64 bit)
- 数字笔记珍宝(Gem for OneNote)下载 v40.1.1.258官方版
- OTT TV影音系统如何做到不丢帧、不卡顿、不花屏
- C 中的malloc/free 与C++中new/delete的区别
- TF随笔-10
- Codeforces #245 (Div. 2)C. Xor-tree(DFS&&贪心
- 关于Cesium中的常用坐标系及说明
- Spring的事务
- vim下用ctags+cscope查找切换
- Spring(12)——BeanFactoryPostProcessor
- 搜索
- Log4j日志组件
- 支持向量机通俗导论(理解SVM的三层境界)