zoukankan      html  css  js  c++  java
  • tensorflow一些常用函数的使用注意

    tf.abs()  求tensor中数据的绝对值

    tf.sign()  每一个数据都执行sigmod函数,得到对应的数值

    tf.reduce_sum()  对不同维度数据求和。注意:1:求和每一行  0:求和每一列

    tf.cast()  数值转换

     演示:

    1 def mytest_split():
    2     A = tf.truncated_normal(shape=[5,6], dtype=tf.float32)
    3     used = tf.sign(tf.abs(A))
    4     length = tf.reduce_sum(used, reduction_indices=1)
    5     with tf.Session() as sess:
    6         print(sess.run([A, used, length]))
    7         print(A, used, length)

    输出:

  • 相关阅读:
    mtu
    OC2_使用系统协议
    OC1_协议语句
    Json文件/网址解析
    文件归档
    Plist文件
    NS-Date/NSDateFormatter
    OC10_文件练习
    OC9_文件操作
    OC8_NSData
  • 原文地址:https://www.cnblogs.com/demo-deng/p/10155939.html
Copyright © 2011-2022 走看看