提交 26a94b39 编写于 作者: W wanghaoshuang

Fix truncated normal.

test=release/1.0.0
上级 b2e6e5f2
......@@ -148,7 +148,7 @@ struct TruncatedNormal {
T operator()(T value) const {
auto p = a_normal_cdf + (b_normal_cdf - a_normal_cdf) * value;
return (std::sqrt(2.0) * Erfinv(2 * p - 1) + mean) * std;
return std::sqrt(2.0) * Erfinv(2 * p - 1) * std + mean;
}
};
......
......@@ -42,7 +42,7 @@ struct TruncatedNormal {
rng.discard(n);
T value = dist(rng);
auto p = a_normal_cdf + (b_normal_cdf - a_normal_cdf) * value;
return (std::sqrt(2.0) * erfinvf(2 * p - 1) + mean) * std;
return std::sqrt(2.0) * erfinvf(2 * p - 1) * std + mean;
}
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册