Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Tensorflow数学运算中的标准差计算_Python_C++_Tensorflow - Fatal编程技术网

Python Tensorflow数学运算中的标准差计算

Python Tensorflow数学运算中的标准差计算,python,c++,tensorflow,Python,C++,Tensorflow,我试图用C++ API来转换Tensorflow中的Python方法(< P/th>) def prewhiten(x): mean = np.mean(x) std = np.std(x) std_adj = np.maximum(std, 1.0/np.sqrt(x.size)) y = np.multiply(np.subtract(x, mean), 1/std_adj) return y 我的转换尚未完成。有谁能用TysFLUE+C++ API

我试图用C++ API来转换Tensorflow中的Python方法(< P/th>)
def prewhiten(x):
    mean = np.mean(x)
    std = np.std(x)
    std_adj = np.maximum(std, 1.0/np.sqrt(x.size))
    y = np.multiply(np.subtract(x, mean), 1/std_adj)
    return y
我的转换尚未完成。有谁能用TysFLUE+C++ API的数学运算来计算标准偏差?
Div(root.WithOpName(out_name), Sub(root, x , Mean(root, x, {}) ), {input_std});
我需要白化一个张量,比如一个矩阵的平均值和标准差


更新1:

我已经实现了一个代码,但结果仍然与python不同。任何C++的ToSoFraceAPI专家都能帮助吗?我目前的转换是:

Mul(root.WithOpName(output_name),
         Sub(root, x,
             Mean(root, x, {1}) ),
              Reciprocal(root, Maximum(root, Sqrt(root, Sum(root,
               Square(root, Sub(root, x,
                Mean(root, x, {1}))), {1})), 1.0/2500.0)));

这里2500是从我的矩阵<代码> x>代码>元素50x50==2500 < /p>你只需要C++吗?我可以在pythonYes中演示如何实现这一点,但如果您能在python中演示,它可能会帮助我在cpp中进行转换