tensorflow - 如何计算矩阵中变量的标准偏差
问题描述
我使用了 tensorflow 1.4,我想测试这个工具。像下面的例子:
将张量流导入为 tf
输入=[50,10]
O1 = layers.fully connected(input, 20, tf.sigmoid)
我猜代码没问题,但不太确定如何计算出矩阵中变量的标准偏差?非常感谢!
解决方案
使用最新的 Tensorflow 版本 2.5,您可以使用计算标准偏差
import tensorflow as tf
x = tf.constant([[1., 2.], [3., 4.]])
tf.math.reduce_std(x)
输出
<tf.Tensor: shape(), dtype=float32, numpy=1.118034>
推荐阅读
- regex - 正则表达式提取两个斜杠之间的字符串和其中的指定字符串
- c# - AutoMapper 映射到 Enum 默认值,而不是在 null 时跳过
- javascript - Zapier Javascript: Unexpected token ] - 在 IDE、Repl.it 和 Node v6.3.1 中工作
- javascript - 从对象内的所有对象中按键移除元素
- php - 使用来自一个视图的输入将结果打印到另一个视图
- c# - C#比较多种类型
- raspberry-pi3 - scp 冻结并创建空文件
- php - Laravel 在雄辩的保存上试运行
- amazon-web-services - 使用 aws java sdk 触发 lambda 函数的 SQS 的返回值
- python - Cython 给出“不必要的”警告