计算 tensorflow 创建的矩阵中变量的标准差 be

Caculate the standard deviation be for the vatiable in the matrix created by tensorflow

import tensorflow as tf
input=[50,10]
O1 = layers.fully connected(input, 20, tf.sigmoid)

为什么我的输入错误?

我不确定我是否理解问题,但是...

sigmoid 层将输出一个数字介于 0 和 1 之间的数组,但在馈入网络之前你无法真正计算出标准差是多少。

如果你说的是包含权重参数的矩阵,那么这取决于你如何初始化它们。但是网络经过训练后,偏差会和训练前不一样了。

编辑:

好的,所以您只想计算矩阵的标准差。在那种情况下,请参见 numpy。

a = np.array([[1, 2], [3, 4]]) # or your 50 by 50 matrix
np.std(a)