提交 d94978bc authored 作者: Frederic's avatar Frederic

Add comment about tensor.{std,var} method on how we compute it.

上级 a3c4acb2
......@@ -3645,6 +3645,10 @@ def var(input, axis=None, keepdims=False):
:param keepdims: If this is set to True, the axes which are reduced are
left in the result as dimensions with size one. With this option,
the result will broadcast correctly against the original tensor.
:note: It use the two-pass algorithm for more stable results.
https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Two-pass_algorithm
It exist other implementation that are even more stable, but probably slower.
"""
input_ndim = input.type.ndim
......@@ -3680,6 +3684,10 @@ def std(input, axis=None, keepdims=False):
With this option,
the result will broadcast correctly against the
original tensor.
:note: It call var and var use the two-pass algorithm for more stable results.
https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Two-pass_algorithm
It exist other implementation that are even more stable, but probably slower.
"""
return sqrt(var(input=input, axis=axis, keepdims=keepdims))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论