meanstddev.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:reslearn 作者: mackcmillion 项目源码 文件源码
def _covariance_final_ops(sum_squares, total):
    # http://www.johnloomis.org/ece563/notes/covar/covar.html
    total = total - tf.constant(1.0)
    total_3x3 = tf.reshape(tf.tile(tf.expand_dims(total, 0), [9]), [3, 3])
    covariance = tf.div(sum_squares, total_3x3)

    variance = tf.gather(tf.reshape(covariance, [-1]), [0, 4, 8])

    # eigenvalues and eigenvectors for PCA
    eigens = tf.self_adjoint_eig(covariance)
    eigenvalues = tf.slice(eigens, [0, 0], [-1, 1])
    eigenvectors = tf.slice(eigens, [1, 0], [-1, -1])

    return tf.sqrt(variance), eigenvalues, eigenvectors
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号