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)

    print sess.run(res)

运行结果:

[[6 1 2]
 [3 4 5]
 [8 2 4]]



原创粉丝点击