TF随笔-10
#!/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)
print sess.run(res)
运行结果:
[[6 1 2]
[3 4 5]
[8 2 4]]
TF随笔-10的更多相关文章
- TF随笔-8
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Jul 10 09:35:04 201 ...
- TF随笔-4
>>> import tensorflow as tf>>> a=tf.constant([[1,2],[3,4]])>>> b=tf.const ...
- tensorflow 基本函数(1.tf.split, 2.tf.concat,3.tf.squeeze, 4.tf.less_equal, 5.tf.where, 6.tf.gather, 7.tf.cast, 8.tf.expand_dims, 9.tf.argmax, 10.tf.reshape, 11.tf.stack, 12tf.less, 13.tf.boolean_mask
1. tf.split(3, group, input) # 拆分函数 3 表示的是在第三个维度上, group表示拆分的次数, input 表示输入的值 import tensorflow ...
- TF随笔-11
#!/usr/bin/env python2 # -*- coding: utf-8 -*- import tensorflow as tf my_var=tf.Variable(0.) step=t ...
- TF随笔-7
求平均值的函数 reduce_mean axis为1表示求行 axis为0表示求列 >>> xxx=tf.constant([[1., 10.],[3.,30.]])>> ...
- TF随笔-13
import tensorflow as tf a=tf.constant(5) b=tf.constant(3) res1=tf.divide(a,b) res2=tf.div(a,b) with ...
- TF随笔-9
计算累加 #!/usr/bin/env python2 # -*- coding: utf-8 -*-"""Created on Mon Jul 24 08:25:41 ...
- tf随笔-6
import tensorflow as tfx=tf.constant([-0.2,0.5,43.98,-23.1,26.58])y=tf.clip_by_value(x,1e-10,1.0)ses ...
- tf随笔-5
# -*- coding: utf-8 -*-import tensorflow as tfw1=tf.Variable(tf.random_normal([2,6],stddev=1))w2=tf. ...
随机推荐
- GET 对比 POST
HTTP 方法:GET 对比 POST HTTP 消息 标签列表(字母排序) 两种最常用的 HTTP 方法是:GET 和 POST. 什么是 HTTP? 超文本传输协议(HTTP)的设计目的是保证客户 ...
- HandyJSON第三方库的日常使用与错误记录
一.错误提示 1.更新Xcode10.2,Swift5.0出现错误提示 Undefined symbols for architecture x86_64: "_swift_getField ...
- Spring容器基础ClassPathXmlApplicationContext(一起看源码)
ApplicationContext相比较于BeanFactory,扩展了很多功能.也就是说前者包含了后者的所有功能.使用前者加载XML的方式:ApplicationContext app=new C ...
- intellij idea rearrange code
reformat code的时候,无法将filed放在method前边,很恶心. 那么先去
- 项目发布后 Tomcat中只有web-INF文件夹
这是有文件夹没有加载 解决办法如下
- easyui combobox 拼音检索快捷选择输入
easyui combobox 拼音检索快捷选择输入 效果如图 $.ajax({ url: UserActionUrl + '?action=listuserworktype', dataType ...
- Python简易项目 加减计算器的实现
Python Calculator 1.0 支持功能:add.minus 输入表达式不含括号,允许不加'=' 非常简单的一个小计算器,还缺少很多功能,目的是为了练练手. 日后会对其进行更新. 源码 G ...
- 解决 libnanomsg.so.0: cannot open shared object file: No such file or directory 无法找到libnanomsg动态链接库
参考: [11]缺少动态连接库.so--cannot open shared object file: No such file or directory Importing Issues: cann ...
- 全文检索引擎Solr系列——整合中文分词组件mmseg4j
默认Solr提供的分词组件对中文的支持是不友好的,比如:“VIM比作是编辑器之神”这个句子在索引的的时候,选择FieldType为”text_general”作为分词依据时,分词效果是: 它把每一个词 ...
- matlab C++ (VS Qt)混合编程 / mxArray / QT5中文乱码
一.混合编程环境搭建---依据我的情况,分成了4个部分: 1:破解matlab,因为matlab破解不完全,编译器不能使用,会出错.(参考https://blog.csdn.net/a12593012 ...